WorksheetProtection

Inheritance: java.lang.Object

public final class WorksheetProtection

Encapsulates worksheet protection options, which allow to protect a worksheet in the output Spreadsheet document from modification of specified type with a specified password.


Most of Spreadsheet formats like XLSX allows to protect a worksheet from editing with password. This class allows to enable such protection and specify its options.

Constructors

Constructor Description
WorksheetProtection() Creates new instance with default parameters.
WorksheetProtection(int protectionType, String password) Creates new instance with specified worksheet protection type and password

Methods

Method Description
getProtectionType() Allows to specify a type of worksheet protection.
setProtectionType(int value) Allows to specify a type of worksheet protection.
getPassword() Password, which is used for protecting a worksheet.
setPassword(String value) Password, which is used for protecting a worksheet.

WorksheetProtection()

public WorksheetProtection()

Creates new instance with default parameters. If not modified and passed to SpreadsheetSaveOptions, no worksheet protection will be applied

WorksheetProtection(int protectionType, String password)

public WorksheetProtection(int protectionType, String password)

Creates new instance with specified worksheet protection type and password

Parameters:

Parameter Type Description
protectionType int Type of worksheet protection
password java.lang.String Password, that locks the protection

getProtectionType()

public final int getProtectionType()

Allows to specify a type of worksheet protection. By default is ‘None’ - protection is not applied.

Returns: int

setProtectionType(int value)

public final void setProtectionType(int value)

Allows to specify a type of worksheet protection. By default is ‘None’ - protection is not applied.

Parameters:

Parameter Type Description
value int

getPassword()

public final String getPassword()

Password, which is used for protecting a worksheet. If NULL or empty string, the protection will not be applied.

Returns: java.lang.String

setPassword(String value)

public final void setPassword(String value)

Password, which is used for protecting a worksheet. If NULL or empty string, the protection will not be applied.

Parameters:

Parameter Type Description
value java.lang.String