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(byte 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(byte 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(byte protectionType, String password)
public WorksheetProtection(byte protectionType, String password)
Creates new instance with specified worksheet protection type and password
Parameters:
Parameter | Type | Description |
---|---|---|
protectionType | byte | Type of worksheet protection |
password | java.lang.String | Password, that locks the protection |
getProtectionType()
public final byte getProtectionType()
Allows to specify a type of worksheet protection. By default is ‘None’ - protection is not applied.
Returns: byte
setProtectionType(byte value)
public final void setProtectionType(byte value)
Allows to specify a type of worksheet protection. By default is ‘None’ - protection is not applied.
Parameters:
Parameter | Type | Description |
---|---|---|
value | byte |
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 |