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 valueDescription
defaultDefault protection.
allNothing is allowed except cell selections.
ObjectsObjects are locked when the sheet is protected.
ScenariosScenarios are locked when the sheet is protected.
FormatCellsFormatting cells is allowed when the sheet is protected.
FormatColumnsFormatting columns is allowed when the sheet is protected.
FormatRowsFormatting rows is allowed when the sheet is protected.
InsertColumnsInserting columns is allowed when the sheet is protected.
InsertRowsInserting rows is allowed when the sheet is protected.
InsertHyperlinksInserting hyperlinks is allowed when the sheet is protected.
DeleteColumnsDeleting columns is allowed when the sheet is protected.
DeleteRowsDeleting rows is allowed when the sheet is protected.
SelLockedCellsSelection of locked cells is locked when the sheet is protected.
SortSorting is allowed when the sheet is protected.
AutoFilterAutofilters are allowed when the sheet is protected.
PivotTablesPivot tables are allowed when the sheet is protected.
SelUnlockedCellsSelection 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


XL.Sheet.SetProtect - XL.Sheet.SetRightToLeft