Class DocumentSettingsPart
java.lang.Object
org.docx4j.openpackaging.Base
org.docx4j.openpackaging.parts.Part
org.docx4j.openpackaging.parts.JaxbXmlPart<E>
org.docx4j.openpackaging.parts.JaxbXmlPartXPathAware<CTSettings>
org.docx4j.openpackaging.parts.WordprocessingML.DocumentSettingsPart
- All Implemented Interfaces:
XPathEnabled<CTSettings>
public final class DocumentSettingsPart extends JaxbXmlPartXPathAware<CTSettings>
-
Field Summary
Fields inherited from class org.docx4j.openpackaging.parts.JaxbXmlPart
jaxbElement, jc, MAX_BYTES_Unmarshal_Error
-
Constructor Summary
Constructors Constructor Description DocumentSettingsPart()
DocumentSettingsPart(PartName partName)
-
Method Summary
Modifier and Type Method Description void
attachTemplate(java.lang.String templatePath)
java.lang.String
getMceIgnorable()
CTCompatSetting
getWordCompatSetting(java.lang.String name)
Get a compatibility setting in the Word namespace, by namevoid
init()
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)boolean
overrideTableStyleFontSizeAndJustification()
Get the value of compatSetting overrideTableStyleFontSizeAndJustificationvoid
protectRestrictEditing(STDocProtect editValue, java.lang.String password, HashAlgorithm hashAlgo)
Enforces the protection with the option specified by passed editValue, password, and HashAlgorithm for the password.void
protectRestrictFormatting(boolean autoFormatOverride, boolean styleLockTheme, boolean styleLockQFSet, java.lang.String password, HashAlgorithm hashAlgo)
Restrict allowed formatting to specified styles.void
removeEnforcement()
Removes protection enforcement.
In the documentProtection tag inside settings.xml file
it sets the value of enforcement to "0" (w:enforcement="0")protected void
setMceIgnorable(McIgnorableNamespaceDeclarator namespacePrefixMapper)
Where the mc:Ignorable attribute is present, ensure its contents matches the ignorable namespaces actually present.void
setOverrideTableStyleFontSizeAndJustification(boolean val)
void
setWordCompatSetting(java.lang.String name, java.lang.String val)
boolean
validateProtectionPassword(java.lang.String password)
Validates the existing passwordMethods inherited from class org.docx4j.openpackaging.parts.JaxbXmlPartXPathAware
createBinderAndJaxbElement, getBinder, getJAXBAssociationsForXPath, getJAXBAssociationsForXPath, getJAXBNodesViaXPath, getJAXBNodesViaXPath, setJaxbElement, unmarshal, unmarshal
Methods inherited from class org.docx4j.openpackaging.parts.JaxbXmlPart
addMcChoiceNamespace, getContents, getJAXBContext, getJaxbElement, getMcChoiceNamespaces, getXML, isContentEqual, isUnmarshalled, marshal, marshal, marshal, marshal, pipe, pipe, pipe, setContents, setJAXBContext, setJaxbElement, transform, variableReplace
Methods inherited from class org.docx4j.openpackaging.parts.Part
getContentLengthAsLoaded, getOwningRelationshipPart, getPackage, getRelationshipType, getSourceRelationship, getSourceRelationships, getVersion, remove, rename, setContentLengthAsLoaded, setOwningRelationshipPart, setPackage, setPartShortcut, setRelationshipType, setSourceRelationship, setVersion
Methods inherited from class org.docx4j.openpackaging.Base
addTargetPart, addTargetPart, addTargetPart, addTargetPart, getContentType, getPartName, getRelationshipsPart, getRelationshipsPart, getUserData, reset, setContentType, setPartName, setRelationships, setUserData
-
Constructor Details
-
Method Details
-
init
public void init() -
setMceIgnorable
Description copied from class:JaxbXmlPart
Where the mc:Ignorable attribute is present, ensure its contents matches the ignorable namespaces actually present.- Overrides:
setMceIgnorable
in classJaxbXmlPart<CTSettings>
-
getMceIgnorable
public java.lang.String getMceIgnorable()- Overrides:
getMceIgnorable
in classJaxbXmlPart<CTSettings>
-
getWordCompatSetting
Get a compatibility setting in the Word namespace, by name- Parameters:
name
-- Returns:
- Throws:
Docx4JException
-
setWordCompatSetting
public void setWordCompatSetting(java.lang.String name, java.lang.String val) -
overrideTableStyleFontSizeAndJustification
public boolean overrideTableStyleFontSizeAndJustification()Get the value of compatSetting overrideTableStyleFontSizeAndJustification- Since:
- 3.3.0
-
setOverrideTableStyleFontSizeAndJustification
public void setOverrideTableStyleFontSizeAndJustification(boolean val) -
protectRestrictFormatting
public void protectRestrictFormatting(boolean autoFormatOverride, boolean styleLockTheme, boolean styleLockQFSet, java.lang.String password, HashAlgorithm hashAlgo) throws Docx4JExceptionRestrict allowed formatting to specified styles. You don't want to use this directly; use the method with the same name in WordprocessingMLPackage- Parameters:
allowedStyleNames
-autoFormatOverride
-styleLockTheme
-styleLockQFSet
-- Throws:
Docx4JException
- Since:
- 3.3.0
-
isRestrictEditingWith
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)- Returns:
- true if documentProtection is enforced with option readOnly
- Since:
- 3.3.0
-
protectRestrictEditing
public void protectRestrictEditing(STDocProtect editValue, java.lang.String password, HashAlgorithm hashAlgo)Enforces the protection with the option specified by passed editValue, password, and HashAlgorithm for the password.- Parameters:
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)- Since:
- 3.3.0
-
validateProtectionPassword
public boolean validateProtectionPassword(java.lang.String password)Validates the existing password- Parameters:
password
-- Returns:
- true, only if password was set and equals, false otherwise
- Since:
- 3.3.0
-
removeEnforcement
public void removeEnforcement()Removes protection enforcement.
In the documentProtection tag inside settings.xml file
it sets the value of enforcement to "0" (w:enforcement="0")- Since:
- 3.3.0
-
attachTemplate
public void attachTemplate(java.lang.String templatePath)- Parameters:
templatePath
-- Since:
- 6.1.0
-