Method ProtectStructure
- Namespace
- DocWright.Spreadsheet
- Assembly
- DocWright.Spreadsheet.dll
ProtectStructure(string?, bool)
Protects the workbook's structure as Excel's Protect Workbook does, with a password hashed as Excel hashes it (SHA-512, a random 16-byte salt, 100,000 spins) or none. A protection the workbook already has is replaced.
public void ProtectStructure(string? password = null, bool lockWindows = false)
Parameters
passwordstringThe password that unprotects it, or null for none.
lockWindowsboolWhether the windows are locked too (Excel for Windows before 2013 only).
Remarks
Protection is a flag for Excel's interface, not security; the password is not kept.
Exceptions
- ArgumentException
The password is empty or holds a character a part cannot store.