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.getWorksheets().add();
var worksheet = workbook.getWorksheets().get(sheetIndex);
//Allowing users to select locked cells of the worksheet
worksheet.getProtection().setAllowSelectingLockedCell(true);
//Allowing users to select unlocked cells of the worksheet
worksheet.getProtection().setAllowSelectingUnlockedCell(true);

Methods

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

getAllowDeletingColumn()

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)

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()

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)

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()

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

getAllowFiltering() : boolean;

setAllowFiltering(boolean)

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()

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

getAllowFormattingCell() : boolean;

setAllowFormattingCell(boolean)

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

setAllowFormattingCell(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getAllowFormattingColumn()

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

getAllowFormattingColumn() : boolean;

setAllowFormattingColumn(boolean)

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

setAllowFormattingColumn(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getAllowFormattingRow()

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

getAllowFormattingRow() : boolean;

setAllowFormattingRow(boolean)

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

setAllowFormattingRow(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getAllowInsertingColumn()

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

getAllowInsertingColumn() : boolean;

setAllowInsertingColumn(boolean)

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

setAllowInsertingColumn(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

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

getAllowInsertingHyperlink() : boolean;

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

setAllowInsertingHyperlink(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getAllowInsertingRow()

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

getAllowInsertingRow() : boolean;

setAllowInsertingRow(boolean)

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

setAllowInsertingRow(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getAllowSorting()

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

getAllowSorting() : boolean;

setAllowSorting(boolean)

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

setAllowSorting(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getAllowUsingPivotTable()

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

getAllowUsingPivotTable() : boolean;

setAllowUsingPivotTable(boolean)

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()

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

getAllowEditingContent() : boolean;

setAllowEditingContent(boolean)

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()

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

getAllowEditingObject() : boolean;

setAllowEditingObject(boolean)

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()

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

getAllowEditingScenario() : boolean;

setAllowEditingScenario(boolean)

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

setAllowEditingScenario(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

getPassword()

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)

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()

Indicates whether the worksheets is protected with password.

isProtectedWithPassword() : boolean;

getAllowSelectingLockedCell()

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

getAllowSelectingLockedCell() : boolean;

setAllowSelectingLockedCell(boolean)

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()

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

getAllowSelectingUnlockedCell() : boolean;

setAllowSelectingUnlockedCell(boolean)

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

setAllowSelectingUnlockedCell(value: boolean) : void;

Parameters:

ParameterTypeDescription
valuebooleanThe value to set.

copy(Protection)

Copy protection info.

copy(source: Protection) : void;

Parameters:

ParameterTypeDescription
sourceProtection

getPasswordHash()

Gets the hash of current password.

getPasswordHash() : number;

verifyPassword(string)

Verifies password.

verifyPassword(password: string) : boolean;

Parameters:

ParameterTypeDescription
passwordstringThe password.

isNull()

Checks whether the implementation object is null.

isNull() : boolean;