PicoXLSX Library Documentation
![]() | WorkbookSetWorkbookProtection Method |
Sets or removes the workbook protection. If protectWindows and protectStructure are both false, the workbook will not be protected
Namespace: PicoXLSX
Assembly: PicoXLSX (in PicoXLSX.dll) Version: 2.4.0.0 (2.4.0)

C#
public void SetWorkbookProtection( bool state, bool protectWindows, bool protectStructure, string password )
Parameters
- state
- Type: SystemBoolean
If true, the workbook will be protected, otherwise not - protectWindows
- Type: SystemBoolean
If true, the windows will be locked if the workbook is protected - protectStructure
- Type: SystemBoolean
If true, the structure will be locked if the workbook is protected - password
- Type: SystemString
Optional password. If null or empty, no password will be set in case of protection
