public class ProtectDocument extends ProtectionSettings
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
log |
pkg| Constructor and Description |
|---|
ProtectDocument(WordprocessingMLPackage pkg) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isRestrictEditingWith(STDocProtect editValue)
Verifies the documentProtection tag inside settings.xml file
if the protection is enforced (w:enforcement="1")
and if the kind of protection equals to passed (STDocProtect.Enum editValue)
|
void |
removeEnforcement()
Removes protection enforcement.
In the documentProtection tag inside settings.xml file it sets the value of enforcement to "0" (w:enforcement="0") |
void |
restrictEditing(STDocProtect editValue)
Enforces the protection with the option specified by passed editValue.
In the documentProtection tag inside settings.xml file it sets the value of enforcement to "1" (w:enforcement="1") and the value of edit to the passed editValue (w:edit="[passed editValue]") sample snippet from settings.xml |
void |
restrictEditing(STDocProtect editValue,
String password)
Enforces the protection with the option specified by passed editValue and password,
using rsaFull (sha1) (like Word 2010).
|
void |
restrictEditing(STDocProtect editValue,
String password,
HashAlgorithm hashAlgo)
Enforces the protection with the option specified by passed editValue, password, and
HashAlgorithm for the password.
|
void |
restrictFormatting(List<String> allowedStyleNames,
boolean removedNotAllowedFormatting,
boolean autoFormatOverride,
boolean styleLockTheme,
boolean styleLockQFSet)
Restrict allowed formatting to specified styles, no password.
|
void |
restrictFormatting(List<String> allowedStyleNames,
boolean removedNotAllowedFormatting,
boolean autoFormatOverride,
boolean styleLockTheme,
boolean styleLockQFSet,
String password)
Restrict allowed formatting to specified styles, password protected.
|
void |
restrictFormatting(List<String> allowedStyleNames,
boolean removedNotAllowedFormatting,
boolean autoFormatOverride,
boolean styleLockTheme,
boolean styleLockQFSet,
String password,
HashAlgorithm hashAlgo)
Restrict allowed formatting to specified styles.
|
boolean |
validateProtectionPassword(String password)
Validates the existing password
|
getMarkAsFinal, getSignatureHelper, setDocSecurity, setMarkAsFinalpublic ProtectDocument(WordprocessingMLPackage pkg)
public void restrictFormatting(List<String> allowedStyleNames, boolean removedNotAllowedFormatting, boolean autoFormatOverride, boolean styleLockTheme, boolean styleLockQFSet) throws Docx4JException
allowedStyleNames - removedNotAllowedFormatting - whether existing usages of styles which aren't allowed are removedautoFormatOverride - styleLockTheme - styleLockQFSet - Docx4JExceptionpublic void restrictFormatting(List<String> allowedStyleNames, boolean removedNotAllowedFormatting, boolean autoFormatOverride, boolean styleLockTheme, boolean styleLockQFSet, String password) throws Docx4JException
allowedStyleNames - removedNotAllowedFormatting - whether existing usages of styles which aren't allowed are removedautoFormatOverride - styleLockTheme - styleLockQFSet - password - Docx4JExceptionpublic void restrictFormatting(List<String> allowedStyleNames, boolean removedNotAllowedFormatting, boolean autoFormatOverride, boolean styleLockTheme, boolean styleLockQFSet, String password, HashAlgorithm hashAlgo) throws Docx4JException
allowedStyleNames - removedNotAllowedFormatting - whether existing usages of styles which aren't allowed are removedautoFormatOverride - styleLockTheme - styleLockQFSet - password - hashAlgo - Docx4JExceptionpublic boolean isRestrictEditingWith(STDocProtect editValue)
public void restrictEditing(STDocProtect editValue)
<w:settings ... >
<w:documentProtection w:edit="[passed editValue]" w:enforcement="1"/>
public void restrictEditing(STDocProtect editValue, String password)
editValue - the protection typepassword - 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 Word 2013)public void restrictEditing(STDocProtect editValue, String password, HashAlgorithm hashAlgo)
editValue - the protection typepassword - 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 Word 2013)public boolean validateProtectionPassword(String password)
password - public void removeEnforcement()
Copyright © 2007-2020. All Rights Reserved.