Protection

Protection class

Represents the various types of protection options available for a worksheet.

class Protection;

Example

const { Workbook } = require("aspose.cells.node");

var workbook = new Workbook();
var sheetIndex = workbook.worksheets.add();
var worksheet = workbook.worksheets.get(sheetIndex);
//Allowing users to select locked cells of the worksheet
worksheet.protection.allowSelectingLockedCell = true;
//Allowing users to select unlocked cells of the worksheet
worksheet.protection.allowSelectingUnlockedCell = true;

Properties

PropertyTypeDescription
allowDeletingColumnbooleanRepresents if the deletion of columns is allowed on a protected worksheet.
allowDeletingRowbooleanRepresents if the deletion of rows is allowed on a protected worksheet.
allowFilteringbooleanRepresents if the user is allowed to make use of an AutoFilter that was created before the sheet was protected.
allowFormattingCellbooleanRepresents if the formatting of cells is allowed on a protected worksheet.
allowFormattingColumnbooleanRepresents if the formatting of columns is allowed on a protected worksheet
allowFormattingRowbooleanRepresents if the formatting of rows is allowed on a protected worksheet
allowInsertingColumnbooleanRepresents if the insertion of columns is allowed on a protected worksheet
allowInsertingHyperlinkbooleanRepresents if the insertion of hyperlinks is allowed on a protected worksheet
allowInsertingRowbooleanRepresents if the insertion of rows is allowed on a protected worksheet
allowSortingbooleanRepresents if the sorting option is allowed on a protected worksheet.
allowUsingPivotTablebooleanRepresents if the user is allowed to manipulate pivot tables on a protected worksheet.
allowEditingContentbooleanRepresents if the user is allowed to edit contents of locked cells on a protected worksheet.
allowEditingObjectbooleanRepresents if the user is allowed to manipulate drawing objects on a protected worksheet.
allowEditingScenariobooleanRepresents if the user is allowed to edit scenarios on a protected worksheet.
allowSelectingLockedCellbooleanRepresents if the user is allowed to select locked cells on a protected worksheet.
allowSelectingUnlockedCellbooleanRepresents if the user is allowed to select unlocked cells on a protected worksheet.
passwordstringRepresents the password to protect the worksheet.
isProtectedWithPasswordbooleanReadonly. Indicates whether the worksheets is protected with password.

Methods

MethodDescription
getAllowDeletingColumn()@deprecated. Please use the ‘allowDeletingColumn’ property instead. Represents if the deletion of columns is allowed on a protected worksheet.
setAllowDeletingColumn(boolean)@deprecated. Please use the ‘allowDeletingColumn’ property instead. Represents if the deletion of columns is allowed on a protected worksheet.
getAllowDeletingRow()@deprecated. Please use the ‘allowDeletingRow’ property instead. Represents if the deletion of rows is allowed on a protected worksheet.
setAllowDeletingRow(boolean)@deprecated. Please use the ‘allowDeletingRow’ property instead. Represents if the deletion of rows is allowed on a protected worksheet.
getAllowFiltering()@deprecated. Please use the ‘allowFiltering’ property instead. Represents if the user is allowed to make use of an AutoFilter that was created before the sheet was protected.
setAllowFiltering(boolean)@deprecated. Please use the ‘allowFiltering’ property instead. Represents if the user is allowed to make use of an AutoFilter that was created before the sheet was protected.
getAllowFormattingCell()@deprecated. Please use the ‘allowFormattingCell’ property instead. Represents if the formatting of cells is allowed on a protected worksheet.
setAllowFormattingCell(boolean)@deprecated. Please use the ‘allowFormattingCell’ property instead. Represents if the formatting of cells is allowed on a protected worksheet.
getAllowFormattingColumn()@deprecated. Please use the ‘allowFormattingColumn’ property instead. Represents if the formatting of columns is allowed on a protected worksheet
setAllowFormattingColumn(boolean)@deprecated. Please use the ‘allowFormattingColumn’ property instead. Represents if the formatting of columns is allowed on a protected worksheet
getAllowFormattingRow()@deprecated. Please use the ‘allowFormattingRow’ property instead. Represents if the formatting of rows is allowed on a protected worksheet
setAllowFormattingRow(boolean)@deprecated. Please use the ‘allowFormattingRow’ property instead. Represents if the formatting of rows is allowed on a protected worksheet
getAllowInsertingColumn()@deprecated. Please use the ‘allowInsertingColumn’ property instead. Represents if the insertion of columns is allowed on a protected worksheet
setAllowInsertingColumn(boolean)@deprecated. Please use the ‘allowInsertingColumn’ property instead. Represents if the insertion of columns is allowed on a protected worksheet
getAllowInsertingHyperlink()@deprecated. Please use the ‘allowInsertingHyperlink’ property instead. Represents if the insertion of hyperlinks is allowed on a protected worksheet
setAllowInsertingHyperlink(boolean)@deprecated. Please use the ‘allowInsertingHyperlink’ property instead. Represents if the insertion of hyperlinks is allowed on a protected worksheet
getAllowInsertingRow()@deprecated. Please use the ‘allowInsertingRow’ property instead. Represents if the insertion of rows is allowed on a protected worksheet
setAllowInsertingRow(boolean)@deprecated. Please use the ‘allowInsertingRow’ property instead. Represents if the insertion of rows is allowed on a protected worksheet
getAllowSorting()@deprecated. Please use the ‘allowSorting’ property instead. Represents if the sorting option is allowed on a protected worksheet.
setAllowSorting(boolean)@deprecated. Please use the ‘allowSorting’ property instead. Represents if the sorting option is allowed on a protected worksheet.
getAllowUsingPivotTable()@deprecated. Please use the ‘allowUsingPivotTable’ property instead. Represents if the user is allowed to manipulate pivot tables on a protected worksheet.
setAllowUsingPivotTable(boolean)@deprecated. Please use the ‘allowUsingPivotTable’ property instead. Represents if the user is allowed to manipulate pivot tables on a protected worksheet.
getAllowEditingContent()@deprecated. Please use the ‘allowEditingContent’ property instead. Represents if the user is allowed to edit contents of locked cells on a protected worksheet.
setAllowEditingContent(boolean)@deprecated. Please use the ‘allowEditingContent’ property instead. Represents if the user is allowed to edit contents of locked cells on a protected worksheet.
getAllowEditingObject()@deprecated. Please use the ‘allowEditingObject’ property instead. Represents if the user is allowed to manipulate drawing objects on a protected worksheet.
setAllowEditingObject(boolean)@deprecated. Please use the ‘allowEditingObject’ property instead. Represents if the user is allowed to manipulate drawing objects on a protected worksheet.
getAllowEditingScenario()@deprecated. Please use the ‘allowEditingScenario’ property instead. Represents if the user is allowed to edit scenarios on a protected worksheet.
setAllowEditingScenario(boolean)@deprecated. Please use the ‘allowEditingScenario’ property instead. Represents if the user is allowed to edit scenarios on a protected worksheet.
getAllowSelectingLockedCell()@deprecated. Please use the ‘allowSelectingLockedCell’ property instead. Represents if the user is allowed to select locked cells on a protected worksheet.
setAllowSelectingLockedCell(boolean)@deprecated. Please use the ‘allowSelectingLockedCell’ property instead. Represents if the user is allowed to select locked cells on a protected worksheet.
getAllowSelectingUnlockedCell()@deprecated. Please use the ‘allowSelectingUnlockedCell’ property instead. Represents if the user is allowed to select unlocked cells on a protected worksheet.
setAllowSelectingUnlockedCell(boolean)@deprecated. Please use the ‘allowSelectingUnlockedCell’ property instead. Represents if the user is allowed to select unlocked cells on a protected worksheet.
getPassword()@deprecated. Please use the ‘password’ property instead. Represents the password to protect the worksheet.
setPassword(string)@deprecated. Please use the ‘password’ property instead. Represents the password to protect the worksheet.
isProtectedWithPassword()@deprecated. Please use the ‘isProtectedWithPassword’ property instead. Indicates whether the worksheets is protected with password.
copy(Protection)Copy protection info.
verifyPassword(string)Verifies password.
getPasswordHash()Gets the hash of current password.
isNull()Checks whether the implementation object is null.

allowDeletingColumn

Represents if the deletion of columns is allowed on a protected worksheet.

allowDeletingColumn : boolean;

Remarks

The columns containing the cells to be deleted must be unlocked when the sheet is protected, and “Select unlocked cells” option must be enabled.

allowDeletingRow

Represents if the deletion of rows is allowed on a protected worksheet.

allowDeletingRow : boolean;

Remarks

The rows containing the cells to be deleted must be unlocked when the sheet is protected, and “Select unlocked cells” option must be enabled.

allowFiltering

Represents if the user is allowed to make use of an AutoFilter that was created before the sheet was protected.

allowFiltering : boolean;

allowFormattingCell

Represents if the formatting of cells is allowed on a protected worksheet.

allowFormattingCell : boolean;

allowFormattingColumn

Represents if the formatting of columns is allowed on a protected worksheet

allowFormattingColumn : boolean;

allowFormattingRow

Represents if the formatting of rows is allowed on a protected worksheet

allowFormattingRow : boolean;

allowInsertingColumn

Represents if the insertion of columns is allowed on a protected worksheet

allowInsertingColumn : boolean;

Represents if the insertion of hyperlinks is allowed on a protected worksheet

allowInsertingHyperlink : boolean;

allowInsertingRow

Represents if the insertion of rows is allowed on a protected worksheet

allowInsertingRow : boolean;

allowSorting

Represents if the sorting option is allowed on a protected worksheet.

allowSorting : boolean;

allowUsingPivotTable

Represents if the user is allowed to manipulate pivot tables on a protected worksheet.

allowUsingPivotTable : boolean;

allowEditingContent

Represents if the user is allowed to edit contents of locked cells on a protected worksheet.

allowEditingContent : boolean;

allowEditingObject

Represents if the user is allowed to manipulate drawing objects on a protected worksheet.

allowEditingObject : boolean;

allowEditingScenario

Represents if the user is allowed to edit scenarios on a protected worksheet.

allowEditingScenario : boolean;

allowSelectingLockedCell

Represents if the user is allowed to select locked cells on a protected worksheet.

allowSelectingLockedCell : boolean;

allowSelectingUnlockedCell

Represents if the user is allowed to select unlocked cells on a protected worksheet.

allowSelectingUnlockedCell : boolean;

password

Represents the password to protect the worksheet.

password : string;

Remarks

If password is set to null or blank string, you can unprotect the worksheet or workbook without using a password. Otherwise, you must specify the password to unprotect the worksheet or workbook.

isProtectedWithPassword

Readonly. Indicates whether the worksheets is protected with password.

isProtectedWithPassword : boolean;

getAllowDeletingColumn()

@deprecated. Please use the ‘allowDeletingColumn’ property instead. Represents if the deletion of columns is allowed on a protected worksheet.

getAllowDeletingColumn() : boolean;

Remarks

The columns containing the cells to be deleted must be unlocked when the sheet is protected, and “Select unlocked cells” option must be enabled.

setAllowDeletingColumn(boolean)

@deprecated. Please use the ‘allowDeletingColumn’ property instead. Represents if the deletion of columns is allowed on a protected worksheet.

setAllowDeletingColumn(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

Remarks

The columns containing the cells to be deleted must be unlocked when the sheet is protected, and “Select unlocked cells” option must be enabled.

getAllowDeletingRow()

@deprecated. Please use the ‘allowDeletingRow’ property instead. Represents if the deletion of rows is allowed on a protected worksheet.

getAllowDeletingRow() : boolean;

Remarks

The rows containing the cells to be deleted must be unlocked when the sheet is protected, and “Select unlocked cells” option must be enabled.

setAllowDeletingRow(boolean)

@deprecated. Please use the ‘allowDeletingRow’ property instead. Represents if the deletion of rows is allowed on a protected worksheet.

setAllowDeletingRow(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

Remarks

The rows containing the cells to be deleted must be unlocked when the sheet is protected, and “Select unlocked cells” option must be enabled.

getAllowFiltering()

@deprecated. Please use the ‘allowFiltering’ property instead. Represents if the user is allowed to make use of an AutoFilter that was created before the sheet was protected.

getAllowFiltering() : boolean;

setAllowFiltering(boolean)

@deprecated. Please use the ‘allowFiltering’ property instead. Represents if the user is allowed to make use of an AutoFilter that was created before the sheet was protected.

setAllowFiltering(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getAllowFormattingCell()

@deprecated. Please use the ‘allowFormattingCell’ property instead. Represents if the formatting of cells is allowed on a protected worksheet.

getAllowFormattingCell() : boolean;

setAllowFormattingCell(boolean)

@deprecated. Please use the ‘allowFormattingCell’ property instead. Represents if the formatting of cells is allowed on a protected worksheet.

setAllowFormattingCell(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getAllowFormattingColumn()

@deprecated. Please use the ‘allowFormattingColumn’ property instead. Represents if the formatting of columns is allowed on a protected worksheet

getAllowFormattingColumn() : boolean;

setAllowFormattingColumn(boolean)

@deprecated. Please use the ‘allowFormattingColumn’ property instead. Represents if the formatting of columns is allowed on a protected worksheet

setAllowFormattingColumn(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getAllowFormattingRow()

@deprecated. Please use the ‘allowFormattingRow’ property instead. Represents if the formatting of rows is allowed on a protected worksheet

getAllowFormattingRow() : boolean;

setAllowFormattingRow(boolean)

@deprecated. Please use the ‘allowFormattingRow’ property instead. Represents if the formatting of rows is allowed on a protected worksheet

setAllowFormattingRow(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getAllowInsertingColumn()

@deprecated. Please use the ‘allowInsertingColumn’ property instead. Represents if the insertion of columns is allowed on a protected worksheet

getAllowInsertingColumn() : boolean;

setAllowInsertingColumn(boolean)

@deprecated. Please use the ‘allowInsertingColumn’ property instead. Represents if the insertion of columns is allowed on a protected worksheet

setAllowInsertingColumn(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

@deprecated. Please use the ‘allowInsertingHyperlink’ property instead. Represents if the insertion of hyperlinks is allowed on a protected worksheet

getAllowInsertingHyperlink() : boolean;

@deprecated. Please use the ‘allowInsertingHyperlink’ property instead. Represents if the insertion of hyperlinks is allowed on a protected worksheet

setAllowInsertingHyperlink(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getAllowInsertingRow()

@deprecated. Please use the ‘allowInsertingRow’ property instead. Represents if the insertion of rows is allowed on a protected worksheet

getAllowInsertingRow() : boolean;

setAllowInsertingRow(boolean)

@deprecated. Please use the ‘allowInsertingRow’ property instead. Represents if the insertion of rows is allowed on a protected worksheet

setAllowInsertingRow(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getAllowSorting()

@deprecated. Please use the ‘allowSorting’ property instead. Represents if the sorting option is allowed on a protected worksheet.

getAllowSorting() : boolean;

setAllowSorting(boolean)

@deprecated. Please use the ‘allowSorting’ property instead. Represents if the sorting option is allowed on a protected worksheet.

setAllowSorting(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getAllowUsingPivotTable()

@deprecated. Please use the ‘allowUsingPivotTable’ property instead. Represents if the user is allowed to manipulate pivot tables on a protected worksheet.

getAllowUsingPivotTable() : boolean;

setAllowUsingPivotTable(boolean)

@deprecated. Please use the ‘allowUsingPivotTable’ property instead. Represents if the user is allowed to manipulate pivot tables on a protected worksheet.

setAllowUsingPivotTable(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getAllowEditingContent()

@deprecated. Please use the ‘allowEditingContent’ property instead. Represents if the user is allowed to edit contents of locked cells on a protected worksheet.

getAllowEditingContent() : boolean;

setAllowEditingContent(boolean)

@deprecated. Please use the ‘allowEditingContent’ property instead. Represents if the user is allowed to edit contents of locked cells on a protected worksheet.

setAllowEditingContent(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getAllowEditingObject()

@deprecated. Please use the ‘allowEditingObject’ property instead. Represents if the user is allowed to manipulate drawing objects on a protected worksheet.

getAllowEditingObject() : boolean;

setAllowEditingObject(boolean)

@deprecated. Please use the ‘allowEditingObject’ property instead. Represents if the user is allowed to manipulate drawing objects on a protected worksheet.

setAllowEditingObject(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getAllowEditingScenario()

@deprecated. Please use the ‘allowEditingScenario’ property instead. Represents if the user is allowed to edit scenarios on a protected worksheet.

getAllowEditingScenario() : boolean;

setAllowEditingScenario(boolean)

@deprecated. Please use the ‘allowEditingScenario’ property instead. Represents if the user is allowed to edit scenarios on a protected worksheet.

setAllowEditingScenario(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getAllowSelectingLockedCell()

@deprecated. Please use the ‘allowSelectingLockedCell’ property instead. Represents if the user is allowed to select locked cells on a protected worksheet.

getAllowSelectingLockedCell() : boolean;

setAllowSelectingLockedCell(boolean)

@deprecated. Please use the ‘allowSelectingLockedCell’ property instead. Represents if the user is allowed to select locked cells on a protected worksheet.

setAllowSelectingLockedCell(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getAllowSelectingUnlockedCell()

@deprecated. Please use the ‘allowSelectingUnlockedCell’ property instead. Represents if the user is allowed to select unlocked cells on a protected worksheet.

getAllowSelectingUnlockedCell() : boolean;

setAllowSelectingUnlockedCell(boolean)

@deprecated. Please use the ‘allowSelectingUnlockedCell’ property instead. Represents if the user is allowed to select unlocked cells on a protected worksheet.

setAllowSelectingUnlockedCell(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getPassword()

@deprecated. Please use the ‘password’ property instead. Represents the password to protect the worksheet.

getPassword() : string;

Remarks

If password is set to null or blank string, you can unprotect the worksheet or workbook without using a password. Otherwise, you must specify the password to unprotect the worksheet or workbook.

setPassword(string)

@deprecated. Please use the ‘password’ property instead. Represents the password to protect the worksheet.

setPassword(value: string) : void;

Parameters:

ParameterTypeDescription
valuestringThe value to set.

Remarks

If password is set to null or blank string, you can unprotect the worksheet or workbook without using a password. Otherwise, you must specify the password to unprotect the worksheet or workbook.

isProtectedWithPassword()

@deprecated. Please use the ‘isProtectedWithPassword’ property instead. Indicates whether the worksheets is protected with password.

isProtectedWithPassword() : boolean;

copy(Protection)

Copy protection info.

copy(source: Protection) : void;

Parameters:

ParameterTypeDescription
sourceProtection

verifyPassword(string)

Verifies password.

verifyPassword(password: string) : boolean;

Parameters:

ParameterTypeDescription
passwordstringThe password.

getPasswordHash()

Gets the hash of current password.

getPasswordHash() : number;

isNull()

Checks whether the implementation object is null.

isNull() : boolean;