Protection

Inheritance: java.lang.Object

public class Protection

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

Example

         //Instantiating a Workbook object
         Workbook workbook = new Workbook();
 
         Worksheet worksheet = workbook.getWorksheets().get(0);
         //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
copy(Protection source)Copy protection info.
equals(Object arg0)
getAllowDeletingColumn()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.
getAllowEditingContent()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.
getAllowEditingScenario()Represents if the user is allowed to edit scenarios 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.
getAllowFormattingCell()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
getAllowFormattingRow()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
getAllowInsertingHyperlink()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
getAllowSelectingLockedCell()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.
getAllowSorting()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.
getClass()
getPassword()Represents the password to protect the worksheet.
getPasswordHash()Gets the hash of current password.
hashCode()
isProtectedWithPassword()Indicates whether the worksheets is protected with password.
notify()
notifyAll()
setAllowDeletingColumn(boolean value)Represents if the deletion of columns is allowed on a protected worksheet.
setAllowDeletingRow(boolean value)Represents if the deletion of rows is allowed on a protected worksheet.
setAllowEditingContent(boolean value)Represents if the user is allowed to edit contents of locked cells on a protected worksheet.
setAllowEditingObject(boolean value)Represents if the user is allowed to manipulate drawing objects on a protected worksheet.
setAllowEditingScenario(boolean value)Represents if the user is allowed to edit scenarios on a protected worksheet.
setAllowFiltering(boolean value)Represents if the user is allowed to make use of an AutoFilter that was created before the sheet was protected.
setAllowFormattingCell(boolean value)Represents if the formatting of cells is allowed on a protected worksheet.
setAllowFormattingColumn(boolean value)Represents if the formatting of columns is allowed on a protected worksheet
setAllowFormattingRow(boolean value)Represents if the formatting of rows is allowed on a protected worksheet
setAllowInsertingColumn(boolean value)Represents if the insertion of columns is allowed on a protected worksheet
setAllowInsertingHyperlink(boolean value)Represents if the insertion of hyperlinks is allowed on a protected worksheet
setAllowInsertingRow(boolean value)Represents if the insertion of rows is allowed on a protected worksheet
setAllowSelectingLockedCell(boolean value)Represents if the user is allowed to select locked cells on a protected worksheet.
setAllowSelectingUnlockedCell(boolean value)Represents if the user is allowed to select unlocked cells on a protected worksheet.
setAllowSorting(boolean value)Represents if the sorting option is allowed on a protected worksheet.
setAllowUsingPivotTable(boolean value)Represents if the user is allowed to manipulate pivot tables on a protected worksheet.
setPassword(String value)Represents the password to protect the worksheet.
toString()
verifyPassword(String password)Verifies password.
wait()
wait(long arg0)
wait(long arg0, int arg1)

copy(Protection source)

public void copy(Protection source)

Copy protection info.

Parameters:

ParameterTypeDescription
sourceProtection

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

getAllowDeletingColumn()

public boolean getAllowDeletingColumn()

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

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.

Returns: boolean

getAllowDeletingRow()

public boolean getAllowDeletingRow()

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

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.

Returns: boolean

getAllowEditingContent()

public boolean getAllowEditingContent()

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

Returns: boolean

getAllowEditingObject()

public boolean getAllowEditingObject()

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

Returns: boolean

getAllowEditingScenario()

public boolean getAllowEditingScenario()

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

Returns: boolean

getAllowFiltering()

public boolean getAllowFiltering()

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

Returns: boolean

getAllowFormattingCell()

public boolean getAllowFormattingCell()

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

Returns: boolean

getAllowFormattingColumn()

public boolean getAllowFormattingColumn()

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

Returns: boolean

getAllowFormattingRow()

public boolean getAllowFormattingRow()

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

Returns: boolean

getAllowInsertingColumn()

public boolean getAllowInsertingColumn()

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

Returns: boolean

public boolean getAllowInsertingHyperlink()

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

Returns: boolean

getAllowInsertingRow()

public boolean getAllowInsertingRow()

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

Returns: boolean

getAllowSelectingLockedCell()

public boolean getAllowSelectingLockedCell()

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

Returns: boolean

getAllowSelectingUnlockedCell()

public boolean getAllowSelectingUnlockedCell()

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

Returns: boolean

getAllowSorting()

public boolean getAllowSorting()

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

Returns: boolean

getAllowUsingPivotTable()

public boolean getAllowUsingPivotTable()

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

Returns: boolean

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getPassword()

public String getPassword()

Represents the password to protect the worksheet.

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.

Returns: java.lang.String

getPasswordHash()

public int getPasswordHash()

Gets the hash of current password.

Returns: int

hashCode()

public native int hashCode()

Returns: int

isProtectedWithPassword()

public boolean isProtectedWithPassword()

Indicates whether the worksheets is protected with password.

Returns: boolean

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

setAllowDeletingColumn(boolean value)

public void setAllowDeletingColumn(boolean value)

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

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.

Parameters:

ParameterTypeDescription
valueboolean

setAllowDeletingRow(boolean value)

public void setAllowDeletingRow(boolean value)

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

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.

Parameters:

ParameterTypeDescription
valueboolean

setAllowEditingContent(boolean value)

public void setAllowEditingContent(boolean value)

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

Parameters:

ParameterTypeDescription
valueboolean

setAllowEditingObject(boolean value)

public void setAllowEditingObject(boolean value)

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

Parameters:

ParameterTypeDescription
valueboolean

setAllowEditingScenario(boolean value)

public void setAllowEditingScenario(boolean value)

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

Parameters:

ParameterTypeDescription
valueboolean

setAllowFiltering(boolean value)

public void setAllowFiltering(boolean value)

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

Parameters:

ParameterTypeDescription
valueboolean

setAllowFormattingCell(boolean value)

public void setAllowFormattingCell(boolean value)

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

Parameters:

ParameterTypeDescription
valueboolean

setAllowFormattingColumn(boolean value)

public void setAllowFormattingColumn(boolean value)

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

Parameters:

ParameterTypeDescription
valueboolean

setAllowFormattingRow(boolean value)

public void setAllowFormattingRow(boolean value)

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

Parameters:

ParameterTypeDescription
valueboolean

setAllowInsertingColumn(boolean value)

public void setAllowInsertingColumn(boolean value)

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

Parameters:

ParameterTypeDescription
valueboolean
public void setAllowInsertingHyperlink(boolean value)

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

Parameters:

ParameterTypeDescription
valueboolean

setAllowInsertingRow(boolean value)

public void setAllowInsertingRow(boolean value)

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

Parameters:

ParameterTypeDescription
valueboolean

setAllowSelectingLockedCell(boolean value)

public void setAllowSelectingLockedCell(boolean value)

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

Parameters:

ParameterTypeDescription
valueboolean

setAllowSelectingUnlockedCell(boolean value)

public void setAllowSelectingUnlockedCell(boolean value)

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

Parameters:

ParameterTypeDescription
valueboolean

setAllowSorting(boolean value)

public void setAllowSorting(boolean value)

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

Parameters:

ParameterTypeDescription
valueboolean

setAllowUsingPivotTable(boolean value)

public void setAllowUsingPivotTable(boolean value)

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

Parameters:

ParameterTypeDescription
valueboolean

setPassword(String value)

public void setPassword(String value)

Represents the password to protect the worksheet.

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.

Parameters:

ParameterTypeDescription
valuejava.lang.String

toString()

public String toString()

Returns: java.lang.String

verifyPassword(String password)

public boolean verifyPassword(String password)

Verifies password.

Parameters:

ParameterTypeDescription
passwordjava.lang.StringThe password.

Returns: boolean -

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int