程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> C# >> C#入門知識 >> C# 通過VSTO操作Excel的Protect方法

C# 通過VSTO操作Excel的Protect方法

編輯:C#入門知識

print?Excel.Worksheet.Protect ( 
    [OptionalAttribute] Object Password, 
    [OptionalAttribute] Object DrawingObjects, 
    [OptionalAttribute] Object Contents, 
    [OptionalAttribute] Object Scenarios, 
    [OptionalAttribute] Object UserInterfaceOnly, 
    [OptionalAttribute] Object AllowFormattingCells, 
    [OptionalAttribute] Object AllowFormattingColumns, 
    [OptionalAttribute] Object AllowFormattingRows, 
    [OptionalAttribute] Object AllowInsertingColumns, 
    [OptionalAttribute] Object AllowInsertingRows, 
    [OptionalAttribute] Object AllowInsertingHyperlinks, 
    [OptionalAttribute] Object AllowDeletingColumns, 
    [OptionalAttribute] Object AllowDeletingRows, 
    [OptionalAttribute] Object AllowSorting, 
    [OptionalAttribute] Object AllowFiltering, 
    [OptionalAttribute] Object AllowUsingPivotTables 

Excel.Worksheet.Protect (
 [OptionalAttribute] Object Password,
 [OptionalAttribute] Object DrawingObjects,
 [OptionalAttribute] Object Contents,
 [OptionalAttribute] Object Scenarios,
 [OptionalAttribute] Object UserInterfaceOnly,
 [OptionalAttribute] Object AllowFormattingCells,
 [OptionalAttribute] Object AllowFormattingColumns,
 [OptionalAttribute] Object AllowFormattingRows,
 [OptionalAttribute] Object AllowInsertingColumns,
 [OptionalAttribute] Object AllowInsertingRows,
 [OptionalAttribute] Object AllowInsertingHyperlinks,
 [OptionalAttribute] Object AllowDeletingColumns,
 [OptionalAttribute] Object AllowDeletingRows,
 [OptionalAttribute] Object AllowSorting,
 [OptionalAttribute] Object AllowFiltering,
 [OptionalAttribute] Object AllowUsingPivotTables
)Password,工作表的密碼,區分大小寫。如果省略此參數,則無需使用密碼即可取消對工作表的保護。否則,您必須指定密碼才能取消對工作表的保護。如果忘記密碼,則無法取消對工作表的保護。最好將密碼及其對應文檔名的列表保存在安全的位置。
DrawingObjects,為 true 時保護形狀。默認值為 false。
Contents,為 true 可保護鎖定單元格中的內容。默認值為 true。
Scenarios,為 true 時保護方案。默認值為 true。
UserInterfaceOnly,為 true 可保護用戶界面,但不保護宏。如果省略此參數,則同時對宏和用戶界面應用保護。
AllowFormattingCells,為 true,則允許用戶格式化受保護的工作表上的任何單元格。默認值為 false。
AllowFormattingColumns,為 true,則允許用戶格式化受保護的工作表上的任何列。默認值為 false。
AllowFormattingRows,為 true,則允許用戶格式化受保護的工作表上的任何行。默認值為 false。
AllowInsertingColumns,為 true,則允許用戶在受保護的工作表上插入列。默認值為 false。
AllowInsertingRows,為 true,則允許用戶在受保護的工作表上插入行。默認值為 false。
AllowInsertingHyperlinks,為 true,則允許用戶在工作表上插入超鏈接。默認值為 false。
AllowDeletingColumns,為 true,則允許用戶在受保護的工作表上刪除列,此處要刪除的列中的每個單元格都已被解除鎖定。默認值為 false。
AllowDeletingRows,為 true,則允許用戶在受保護的工作表上刪除行,此處要刪除的行中的每個單元格都已被解除鎖定。默認值為 false。
AllowSorting,為 true,則允許用戶在受保護的工作表上進行排序。排序范圍中的每個單元格都必須已解除鎖定或不受保護。默認值為 false。
AllowFiltering,為 true,則允許用戶在受保護的工作表上設置篩選器。用戶可以更改篩選條件,但不能啟用或禁用自動篩選。用戶可以在現有的自動篩選上設置篩選器。默認值為 false。
AllowUsingPivotTables,為 true,則允許用戶在受保護的工作表上使用數據透視表。默認值為 false。

 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved