WorkbookProtection Class
Workbook protection settings. Supported in XLSX only.
- Inheritance:
- System.ObjectWorkbookProtection
Remarks
Properties in this class are simply written to Excel file and have no effect on the behavior of this library. For more information on workbook protection, consult Microsoft Excel documentation.
Properties
HasPassword
Gets a value indicating whether the protected workbook has a password.
Property Value
- System.Boolean
PasswordHash
Gets or sets the password hash for protected workbook.
Property Value
- System.Int32
Remarks
This property needs to be set to ushort value (property is of type int because ushort is not CLS compliant). For setting password, a SetPassword(String) method can also be used.
ProtectStructure
Gets or sets if workbook structure is protected. Default value is false.
Property Value
- System.Boolean
ProtectWindows
Gets or sets if workbook window is protected. Default value is false.
Property Value
- System.Boolean
Methods
SetPassword(String)
Sets the password for protected workbook.
Parameters
password
- System.String
The password.