public class ProtectWorkbook extends ProtectionSettings
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
log |
pkg| Constructor and Description |
|---|
ProtectWorkbook(SpreadsheetMLPackage pkg) |
| Modifier and Type | Method and Description |
|---|---|
CTSheetProtection |
getSheetProtection(WorksheetPart worksheetPart)
Use this method to get the CTSheetProtection object for the specified worksheet, so you can set its
parameters as you see fit.
|
void |
removeWorkbookProtection()
Remove protection from this package.
|
void |
setSheetProtection(CTSheetProtection sheetProtection,
String password,
HashAlgorithm hashAlgo)
Enforces the protection passed in sheetProtection, with the specified password, and
HashAlgorithm for the password.
|
void |
setSheetProtectionPassword(CTSheetProtection sheetProtection,
String password)
Enforces the protection passed in sheetProtection, with the specified password,
using sha512 (like Excel 2013).
|
void |
setWorkbookProtection(String password,
boolean lockRevision,
boolean lockStructure,
boolean lockWindows)
Enforce Workbook Protection, with the specified password,
using sha512 (like Excel 2013).
|
void |
setWorkbookProtection(String password,
HashAlgorithm hashAlgo,
boolean lockRevision,
boolean lockStructure,
boolean lockWindows)
Enforce Workbook Protection, with the specified password,
using hashAlgo.
|
static boolean |
validateSheetProtectionPassword(CTSheetProtection sheetProtection,
String password)
Validates the password, i.e.
|
boolean |
validateWorkbookProtectionPassword(String password)
Check the password is correct?
|
getMarkAsFinal, getSignatureHelper, setDocSecurity, setMarkAsFinalpublic ProtectWorkbook(SpreadsheetMLPackage pkg)
public void removeWorkbookProtection()
throws Xlsx4jException
Xlsx4jExceptionpublic void setWorkbookProtection(String password, boolean lockRevision, boolean lockStructure, boolean lockWindows) throws Xlsx4jException
password - if null, no password will be usedlockRevision - lockStructure - lockWindows - Xlsx4jExceptionpublic void setWorkbookProtection(String password, HashAlgorithm hashAlgo, boolean lockRevision, boolean lockStructure, boolean lockWindows) throws Xlsx4jException
password - if null, no password will be usedhashAlgo - lockRevision - lockStructure - lockWindows - Xlsx4jExceptionpublic boolean validateWorkbookProtectionPassword(String password) throws Xlsx4jException
password - Xlsx4jExceptionpublic CTSheetProtection getSheetProtection(WorksheetPart worksheetPart) throws Xlsx4jException
worksheetPart - Xlsx4jExceptionpublic void setSheetProtectionPassword(CTSheetProtection sheetProtection, String password) throws Xlsx4jException
sheetProtection - password - Xlsx4jExceptionpublic void setSheetProtection(CTSheetProtection sheetProtection, String password, HashAlgorithm hashAlgo) throws Xlsx4jException
password - the plaintext password, if null no password will be appliedhashAlgo - the hash algorithm - only md2, m5, sha1, sha256, sha384 and sha512 are supported.
if null, it will default default to sha512 (like Excel 2013)
if none, it will behave like Excel 2010Xlsx4jExceptionpublic static boolean validateSheetProtectionPassword(CTSheetProtection sheetProtection, String password)
sheetProtection - password - the password, if null the method will always return false,
even if there's no password setCopyright © 2007-2020. All Rights Reserved.