public class XWPFSettings extends POIXMLDocumentPart
POIXMLDocumentPart.RelationPart
Constructor and Description |
---|
XWPFSettings() |
XWPFSettings(PackagePart part) |
Modifier and Type | Method and Description |
---|---|
protected void |
commit()
Save the content in the underlying package part.
|
boolean |
getEvenAndOddHeadings()
Check if separate even and odd headings is turned on.
|
boolean |
getMirrorMargins()
Check if mirrored margins is turned on
|
long |
getZoomPercent()
Set zoom.
In the zoom tag inside settings.xml file it sets the value of zoom sample snippet from settings.xml |
boolean |
isEnforcedWith()
Verifies the documentProtection tag inside settings.xml file
if the protection is enforced (w:enforcement="1") |
boolean |
isEnforcedWith(org.openxmlformats.schemas.wordprocessingml.x2006.main.STDocProtect.Enum 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 |
isTrackRevisions()
Check if revision tracking is turned on.
|
protected void |
onDocumentRead()
Fired when a package part is read
|
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 |
setEnforcementEditValue(org.openxmlformats.schemas.wordprocessingml.x2006.main.STDocProtect.Enum 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 |
setEnforcementEditValue(org.openxmlformats.schemas.wordprocessingml.x2006.main.STDocProtect.Enum editValue,
java.lang.String password,
HashAlgorithm hashAlgo)
Enforces the protection with the option specified by passed editValue and password.
sample snippet from settings.xml |
void |
setEvenAndOddHeadings(boolean enable)
Turn separate even-and-odd headings on or off
|
void |
setMirrorMargins(boolean enable)
Turn mirrored margins on or off
|
void |
setTrackRevisions(boolean enable)
Enable or disable revision tracking.
|
void |
setUpdateFields()
Enforces fields update on document open (in Word).
|
void |
setZoomPercent(long zoomPercent)
Set zoom.
In the zoom tag inside settings.xml file it sets the value of zoom sample snippet from settings.xml |
boolean |
validateProtectionPassword(java.lang.String password)
Validates the existing password
|
_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, getTargetPart, isCommitted, onDocumentCreate, onDocumentRemove, onSave, prepareForCommit, read, rebase, removeRelation, removeRelation, removeRelation, setCommitted, toString
public XWPFSettings(PackagePart part) throws java.io.IOException
java.io.IOException
public XWPFSettings()
protected void onDocumentRead() throws java.io.IOException
POIXMLDocumentPart
onDocumentRead
in class POIXMLDocumentPart
java.io.IOException
- a subclass may throw an IOException when a document is readpublic long getZoomPercent()
<w:zoom w:percent="50" />
public void setZoomPercent(long zoomPercent)
<w:zoom w:percent="50" />
public boolean isEnforcedWith()
sample snippet from settings.xml
<w:settings ... > <w:documentProtection w:edit="readOnly" w:enforcement="1"/>
public boolean isEnforcedWith(org.openxmlformats.schemas.wordprocessingml.x2006.main.STDocProtect.Enum editValue)
sample snippet from settings.xml
<w:settings ... > <w:documentProtection w:edit="readOnly" w:enforcement="1"/>
public void setEnforcementEditValue(org.openxmlformats.schemas.wordprocessingml.x2006.main.STDocProtect.Enum editValue)
<w:settings ... > <w:documentProtection w:edit="[passed editValue]" w:enforcement="1"/>
public void setEnforcementEditValue(org.openxmlformats.schemas.wordprocessingml.x2006.main.STDocProtect.Enum editValue, java.lang.String password, HashAlgorithm hashAlgo)
<w:documentProtection w:edit="[passed editValue]" w:enforcement="1" w:cryptProviderType="rsaAES" w:cryptAlgorithmClass="hash" w:cryptAlgorithmType="typeAny" w:cryptAlgorithmSid="14" w:cryptSpinCount="100000" w:hash="..." w:salt="...." />
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 sha1public boolean validateProtectionPassword(java.lang.String password)
password
- the passwordpublic void removeEnforcement()
public void setUpdateFields()
NOTICES:
public boolean isTrackRevisions()
true
if revision tracking is turned onpublic void setTrackRevisions(boolean enable)
enable
- true
to turn on revision tracking, false
to turn off revision trackingprotected void commit() throws java.io.IOException
POIXMLDocumentPart
Sub-classes should override and add logic to marshal the "model" into Ooxml4J.
For example, the code saving a generic XML entry may look as follows:
protected void commit() throws IOException { PackagePart part = getPackagePart(); try (OutputStream out = part.getOutputStream()) { XmlObject bean = getXmlBean(); //the "model" which holds changes in memory bean.save(out, DEFAULT_XML_OPTIONS); } }
commit
in class POIXMLDocumentPart
java.io.IOException
- a subclass may throw an IOException if the changes can't be committedpublic boolean getEvenAndOddHeadings()
public void setEvenAndOddHeadings(boolean enable)
enable
- true
to turn on separate even and odd headings,
false
to turn off even and odd headings.public boolean getMirrorMargins()
public void setMirrorMargins(boolean enable)
enable
- true
to turn on mirrored margins,
false
to turn off mirrored marginss.Copyright 2022 The Apache Software Foundation or its licensors, as applicable.