Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
XL.Sheet.SetProtectEx
Protects/unprotects the sheet with password and enhanced parameters below.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
XL | 7.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "XL.Sheet.SetProtectEx"; bookRef; sheetIndex; protect; Password; ProtectEx ) More
Parameters
Parameter | Description | Example |
---|---|---|
bookRef | The reference to the workbook. Please use XL.LoadBook to load a file. | $ref |
sheetIndex | The index of the sheet. This number ranges from 0 to XL.Book.SheetCount-1. | 0 |
protect | Whether to protect. Pass 1 to enable protection and 0 to disable. |
1 |
Password | The password to use. | |
ProtectEx | The new protection setting. This can be a list of several options or a number. |
"default" |
Result
Returns OK or error.
Description
Protects/unprotects the sheet with password and enhanced parameters below.It is possible to combine a few Enhanced Protection values.
Enhanced Protection value | Description |
default | Default protection. |
all | Nothing is allowed except cell selections. |
Objects | Objects are locked when the sheet is protected. |
Scenarios | Scenarios are locked when the sheet is protected. |
FormatCells | Formatting cells is allowed when the sheet is protected. |
FormatColumns | Formatting columns is allowed when the sheet is protected. |
FormatRows | Formatting rows is allowed when the sheet is protected. |
InsertColumns | Inserting columns is allowed when the sheet is protected. |
InsertRows | Inserting rows is allowed when the sheet is protected. |
InsertHyperlinks | Inserting hyperlinks is allowed when the sheet is protected. |
DeleteColumns | Deleting columns is allowed when the sheet is protected. |
DeleteRows | Deleting rows is allowed when the sheet is protected. |
SelLockedCells | Selection of locked cells is locked when the sheet is protected. |
Sort | Sorting is allowed when the sheet is protected. |
AutoFilter | Autofilters are allowed when the sheet is protected. |
PivotTables | Pivot tables are allowed when the sheet is protected. |
SelUnlockedCells | Selection of unlocked cells is locked when the sheet is protected. |
LibXL can't currently encrypt the whole document, but only protect individual sheets from editing. If you need more, please use Archive functions to create a password protected zip file.
See also
This function checks for a license.
Created 22nd April 2017, last changed 22nd September 2023