Spire.XLS 教程:保护和取消保护工作表
来源:互联网 发布:阿里巴巴淘宝城地址 编辑:程序博客网 时间:2024/05/16 17:40
VSTO
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Xml.Linq;using Excel = Microsoft.Office.Interop.Excel;using Office = Microsoft.Office.Core;using Microsoft.Office.Tools.Excel;using System.Reflection; namespace VSTO{ public partial class ThisAddIn { private void ThisAddIn_Startup(object sender, System.EventArgs e) { //Add a new workbook Excel.Workbook excelApp = this.Application.Workbooks.Add(); //Protect the worksheet with password ((Excel.Worksheet)excelApp.ActiveSheet).Protect("Spire"); //Unprotect the worksheet specifying its password ((Excel.Worksheet)excelApp.ActiveSheet).Unprotect("Spire"); //Save the file excelApp.SaveAs("Result.xlsx"); } private void ThisAddIn_Shutdown(object sender, System.EventArgs e) { } #region VSTO generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InternalStartup() { this.Startup += new System.EventHandler(ThisAddIn_Startup); this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown); } #endregion }}
Spire.XLS
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using Spire.Xls; namespace Spire.XLS{ class Program { static void Main(string[] args) { //Initialize a new instance of workbook Workbook wb = new Workbook(); //Protect the worksheet with password Worksheet sheet = wb.Worksheets[0]; sheet.Protect("Spire", SheetProtectionType.None); //Unprotect the worksheet specifying its password sheet.Unprotect("Spire"); //Save and Launch wb.SaveToFile("Result.xlsx"); System.Diagnostics.Process.Start("Result.xlsx"); } }}
点击下载Spire.XLS
慧都控件网
阅读全文
0 0
- Spire.XLS 教程:保护和取消保护工作表
- Excel2007工作表的保护包括单元格保护及取消保护等等
- 【教程】Spire.XLS 教程:在C#中将形状插入Excel工作表
- excel取消工作表保护 获取原始密码
- excel工作表保护
- EXCEL工作表保护密码破解 宏撤销保护图文教程(转贴)
- EXCEL工作表保护密码忘记,撤消工作表保护
- 撤销工作表保护密码
- 如何保护Excel工作表
- 破解工作表保护密码
- 破解excel保护工作表
- 破解office 工作表保护
- 一周工作,及怎么样取消Word文档保护密码
- EXCEL工作表保护密码忘记,撤销保护攻略
- EXCEL工作表保护密码忘记,撤销保护攻略
- EXCEL工作表保护密码忘记,撤销保护攻略
- Spire.XLS 教程:将Excel导出到XML和XML导入Excel
- Spire.XLS 教程:从C#的Excel形状中提取文本和图像
- PATbasic1002
- easyui主界面传统布局,tab页面等
- windows环境下Python2.X和Python3.X共存的问题
- Hadoop基础教程-第12章 Hive:进阶(12.5 Hive外表)(草稿)
- qt使用布局进行窗口切换
- Spire.XLS 教程:保护和取消保护工作表
- Eclipse 如何切换工作空间(workspace)
- 关于String面试题
- 自定义实现侧滑菜单功能
- SurfaceView的使用—思路的顿悟
- 04:填空:类型转换1
- jdk和jre的区别
- ReclyView详解
- VUE 引入JQ