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 (设置缩放。在 settings.xml 文件中的缩放标签中,它设置来自 settings.xml 的缩放示例片段的值) |
boolean |
isEnforcedWith()
Verifies the documentProtection tag inside settings.xml file
if the protection is enforced (w:enforcement="1") (如果强制执行保护,则验证 settings.xml 文件中的 documentProtection 标记 (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) (如果强制执行保护 (w:enforcement="1") 并且保护类型等于通过 (STDocProtect.Enum editValue),则验证 settings.xml 文件中的 documentProtection 标记) |
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") (删除保护强制。在 settings.xml 文件中的 documentProtection 标记中,它将强制值设置为“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 (使用传递的 editValue 指定的选项强制执行保护。在 settings.xml 文件中的 documentProtection 标记中,它将强制值设置为“1”(w:enforcement="1"),并将编辑值设置为传递的 editValue(w:edit="[passed editValue]")示例来自 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 (使用传递的 editValue 和密码指定的选项强制执行保护。来自 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).
(强制在文档打开时更新字段(在 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 (设置缩放。在 settings.xml 文件中的缩放标签中,它设置来自 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
(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 read
(java.io.IOException - 读取文档时子类可能会抛出 IOException)
public long getZoomPercent()
<w:zoom w:percent="50" />(设置缩放。在 settings.xml 文件中的缩放标签中,它设置来自 settings.xml 的缩放示例片段的值
public void setZoomPercent(long zoomPercent)
<w:zoom w:percent="50" />(设置缩放。在 settings.xml 文件中的缩放标签中,它设置来自 settings.xml 的缩放示例片段的值
public boolean isEnforcedWith()
sample snippet from settings.xml
<w:settings ... > <w:documentProtection w:edit="readOnly" w:enforcement="1"/>(如果强制执行保护 (w:enforcement="1") 来自 settings.xml 的示例片段,则验证 settings.xml 文件中的 documentProtection 标记
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"/>(验证 settings.xml 文件中的 documentProtection 标记是否强制执行保护 (w:enforcement="1") 并且保护类型是否等于从 settings.xml 传递的 (STDocProtect.Enum editValue) 示例片段
public void setEnforcementEditValue(org.openxmlformats.schemas.wordprocessingml.x2006.main.STDocProtect.Enum editValue)
<w:settings ... > <w:documentProtection w:edit="[passed editValue]" w:enforcement="1"/>(使用传递的 editValue 指定的选项强制执行保护。在 settings.xml 文件中的 documentProtection 标记中,它将强制值设置为“1”(w:enforcement="1"),并将编辑值设置为传递的 editValue(w:edit="[passed editValue]")示例来自 settings.xml 的片段
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 和密码指定的选项强制执行保护。来自 settings.xml 的示例片段
editValue
- the protection type
(editValue - 保护类型)
password
- the plaintext password, if null no password will be applied
(password - 明文密码,如果为 null 则不应用密码)
hashAlgo
- the hash algorithm - only md2, m5, sha1, sha256, sha384 and sha512 are supported. if null, it will default default to sha1
(hashAlgo - 哈希算法 - 仅支持 md2、m5、sha1、sha256、sha384 和 sha512。如果为 null,则默认为 sha1)
public boolean validateProtectionPassword(java.lang.String password)
password
- the password
(密码 - 密码)
public void removeEnforcement()
public void setUpdateFields()
NOTICES:
public boolean isTrackRevisions()
true
if revision tracking is turned on
(如果打开了修订跟踪,则为 true)
public void setTrackRevisions(boolean enable)
enable
-
true
to turn on revision tracking,
false
to turn off revision tracking
(enable - true 打开修订跟踪,false 关闭修订跟踪)
protected 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(); OutputStream out = part.getOutputStream(); XmlObject bean = getXmlBean(); //the "model" which holds changes in memory bean.save(out, DEFAULT_XML_OPTIONS); out.close(); }(将内容保存在底层包部分中。默认实现是空的,这意味着包部分保持不变。子类应覆盖并添加逻辑以将“模型”编组到 Ooxml4J。例如,保存通用 XML 条目的代码可能如下所示: protected void commit() throws IOException { PackagePart part = getPackagePart();输出流输出 = part.getOutputStream(); XmlObject bean = getXmlBean(); //保存内存变化的“模型” bean.save(out, DEFAULT_XML_OPTIONS); out.close(); })
commit
in class
POIXMLDocumentPart
java.io.IOException
- a subclass may throw an IOException if the changes can't be committed
(java.io.IOException - 如果无法提交更改,子类可能会抛出 IOException)
public 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.
(enable - true 打开单独的偶数和奇数标题,false 关闭偶数和奇数标题。)
public boolean getMirrorMargins()
public void setMirrorMargins(boolean enable)
enable
-
true
to turn on mirrored margins,
false
to turn off mirrored marginss.
(enable - true 打开镜像边距,false 关闭镜像边距。)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.