public class XWPFDocument extends POIXMLDocument implements Document, IBody
High(ish) level class for working with .docx files.
This class tries to hide some of the complexity of the underlying file format, but as it's not a mature and stable API yet, certain parts of the XML structure come through. You'll therefore almost certainly need to refer to the OOXML specifications from http://www.ecma-international.org/publications/standards/Ecma-376.htm at some point in your use.
(用于处理 .docx 文件的高级(ish)类。这个类试图隐藏底层文件格式的一些复杂性,但由于它还不是一个成熟和稳定的 API,XML 结构的某些部分可以通过。因此,您几乎肯定需要在使用的某个时候参考 http://www.ecma-international.org/publications/standards/Ecma-376.htm 中的 OOXML 规范。)POIXMLDocumentPart.RelationPart
Modifier and Type | Field and Description |
---|---|
protected java.util.List<IBodyElement> |
bodyElements |
protected java.util.List<XWPFChart> |
charts |
protected java.util.List<XWPFComment> |
comments |
protected java.util.List<XWPFSDT> |
contentControls |
protected XWPFEndnotes |
endnotes |
protected java.util.List<XWPFFooter> |
footers |
protected XWPFFootnotes |
footnotes |
protected java.util.List<XWPFHeader> |
headers |
protected java.util.List<XWPFHyperlink> |
hyperlinks |
protected XWPFNumbering |
numbering |
protected java.util.Map<java.lang.Long,java.util.List<XWPFPictureData>> |
packagePictures |
protected java.util.List<XWPFParagraph> |
paragraphs |
protected java.util.List<XWPFPictureData> |
pictures |
protected XWPFStyles |
styles |
protected java.util.List<XWPFTable> |
tables |
DOCUMENT_CREATOR, OLE_OBJECT_REL_TYPE, PACK_OBJECT_REL_TYPE
PICTURE_TYPE_BMP, PICTURE_TYPE_DIB, PICTURE_TYPE_EMF, PICTURE_TYPE_EPS, PICTURE_TYPE_GIF, PICTURE_TYPE_JPEG, PICTURE_TYPE_PICT, PICTURE_TYPE_PNG, PICTURE_TYPE_TIFF, PICTURE_TYPE_WMF, PICTURE_TYPE_WPG
Constructor and Description |
---|
XWPFDocument() |
XWPFDocument(java.io.InputStream is) |
XWPFDocument(OPCPackage pkg) |
Modifier and Type | Method and Description |
---|---|
XWPFEndnote |
addEndnote(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn note)
Add a CTFtnEdn endnote to the document.
(在文档中添加 CTFtnEdn 尾注。)
|
XWPFFootnote |
addFootnote(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn note)
Add a CTFtnEdn footnote to the document.
(在文档中添加 CTFtnEdn 脚注。)
|
java.lang.String |
addPictureData(byte[] pictureData, int format) |
java.lang.String |
addPictureData(java.io.InputStream is, int format) |
protected void |
commit()
commit and saves the document
(提交并保存文档)
|
XWPFChart |
createChart()
This method is used to create template for chart XML no need to read MS-Word file and modify charts
(此方法用于创建图表 XML 模板,无需读取 MS-Word 文件和修改图表)
|
XWPFChart |
createChart(int width, int height)
This method is used to create template for chart XML no need to read MS-Word file and modify charts
(此方法用于创建图表 XML 模板,无需读取 MS-Word 文件和修改图表)
|
XWPFChart |
createChart(XWPFRun run, int width, int height) |
XWPFEndnote |
createEndnote()
Create a new end note and add it to the document.
(创建一个新的尾注并将其添加到文档中。)
|
XWPFEndnotes |
createEndnotes() |
XWPFFooter |
createFooter(HeaderFooterType type)
Create a footer of the given type
(创建给定类型的页脚)
|
XWPFFootnote |
createFootnote()
Create a new footnote and add it to the document.
(创建一个新的脚注并将其添加到文档中。)
|
XWPFFootnotes |
createFootnotes()
Creates an empty footnotes element for the document if one does not already exist
(如果文档尚不存在,则为文档创建一个空的脚注元素)
|
XWPFHeader |
createHeader(HeaderFooterType type)
Create a header of the given type
(创建给定类型的标头)
|
XWPFHeaderFooterPolicy |
createHeaderFooterPolicy() |
XWPFNumbering |
createNumbering()
Creates an empty numbering if one does not already exist and sets the numbering member
(如果不存在,则创建一个空编号并设置编号成员)
|
XWPFParagraph |
createParagraph()
Appends a new paragraph to this document
(在本文档中追加一个新段落)
|
XWPFStyles |
createStyles()
Creates an empty styles for the document if one does not already exist
(如果文档尚不存在,则为文档创建一个空样式)
|
XWPFTable |
createTable()
Create an empty table with one row and one column as default.
(创建一个空表,默认为一行一列。)
|
XWPFTable |
createTable(int rows, int cols)
Create an empty table with a number of rows and cols specified
(创建一个指定行数和列数的空表)
|
void |
createTOC() |
void |
enforceCommentsProtection()
Enforce the Comments protection.
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 comments (w:edit="comments") sample snippet from settings.xml (强制执行评论保护。在 settings.xml 文件中的 documentProtection 标记中,它将强制值设置为“1”(w:enforcement="1"),并将编辑值设置为注释(w:edit="comments")示例片段。 xml) |
void |
enforceCommentsProtection(java.lang.String password, HashAlgorithm hashAlgo)
Enforce the Comments protection.
sample snippet from settings.xml (强制执行评论保护。来自 settings.xml 的示例片段) |
void |
enforceFillingFormsProtection()
Enforce the Filling Forms protection.
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 forms (w:edit="forms") sample snippet from settings.xml (强制填写表格保护。在 settings.xml 文件中的 documentProtection 标记中,它将强制值设置为“1”(w:enforcement="1"),并将编辑值设置为表单(w:edit="forms")示例片段。 xml) |
void |
enforceFillingFormsProtection(java.lang.String password, HashAlgorithm hashAlgo)
Enforce the Filling Forms protection.
sample snippet from settings.xml (强制填写表格保护。来自 settings.xml 的示例片段) |
void |
enforceReadonlyProtection()
Enforces the readOnly protection.
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 readOnly (w:edit="readOnly") sample snippet from settings.xml (强制执行只读保护。在 settings.xml 文件内的 documentProtection 标记中,它将强制值设置为“1”(w:enforcement="1"),并将编辑值设置为只读(w:edit="readOnly")示例片段。 xml) |
void |
enforceReadonlyProtection(java.lang.String password, HashAlgorithm hashAlgo)
Enforces the readOnly protection with a password.
sample snippet from settings.xml (使用密码强制执行只读保护。来自 settings.xml 的示例片段) |
void |
enforceTrackedChangesProtection()
Enforce the Tracked Changes protection.
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 trackedChanges (w:edit="trackedChanges") sample snippet from settings.xml (实施跟踪更改保护。在 settings.xml 文件中的 documentProtection 标记中,它将强制值设置为“1”(w:enforcement="1"),并将编辑值设置为 trackedChanges(w:edit="trackedChanges")示例片段。 xml) |
void |
enforceTrackedChangesProtection(java.lang.String password, HashAlgorithm hashAlgo)
Enforce the Tracked Changes protection.
sample snippet from settings.xml (实施跟踪更改保护。来自 settings.xml 的示例片段) |
void |
enforceUpdateFields()
Enforces fields update on document open (in Word).
(强制在文档打开时更新字段(在 Word 中)。)
|
java.util.List<PackagePart> |
getAllEmbeddedParts()
Get the document's embedded files.
(获取文档的嵌入文件。)
|
java.util.List<XWPFPictureData> |
getAllPackagePictures() |
java.util.List<XWPFPictureData> |
getAllPictures()
Returns all Pictures, which are referenced from the document itself.
(返回从文档本身引用的所有图片。)
|
java.util.List<IBodyElement> |
getBodyElements()
returns an Iterator with paragraphs and tables
(返回带有段落和表格的迭代器)
|
java.util.Iterator<IBodyElement> |
getBodyElementsIterator() |
java.util.List<XWPFChart> |
getCharts() |
XWPFComment |
getCommentByID(java.lang.String id) |
XWPFComment[] |
getComments() |
org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDocument1 |
getDocument()
Returns the low level document base object
(返回低级文档基础对象)
|
XWPFEndnote |
getEndnoteByID(int id) |
java.util.List<XWPFEndnote> |
getEndnotes()
Gets the list of end notes for the document.
(获取文档的结束注释列表。)
|
boolean |
getEvenAndOddHeadings()
Returns the even-and-odd-headings setting
(返回偶数和奇数标题设置)
|
XWPFFooter |
getFooterArray(int pos) |
java.util.List<XWPFFooter> |
getFooterList() |
XWPFFootnote |
getFootnoteByID(int id) |
java.util.List<XWPFFootnote> |
getFootnotes() |
XWPFHeader |
getHeaderArray(int pos) |
XWPFHeaderFooterPolicy |
getHeaderFooterPolicy()
Returns the policy on headers and footers, which also provides a way to get at them.
(返回页眉和页脚的策略,这也提供了一种获取它们的方法。)
|
java.util.List<XWPFHeader> |
getHeaderList() |
XWPFHyperlink |
getHyperlinkByID(java.lang.String id) |
XWPFHyperlink[] |
getHyperlinks() |
XWPFParagraph |
getLastParagraph() |
boolean |
getMirrorMargins()
Returns the mirror margins setting
(返回镜像边距设置)
|
int |
getNextPicNameNumber(int format)
get the next free ImageNumber
(获取下一个免费的 ImageNumber)
|
XWPFNumbering |
getNumbering()
getNumbering
(获取编号)
|
XWPFParagraph |
getParagraph(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP p)
Returns the paragraph corresponding to the provided
CTP .
(返回与提供的 CTP 对应的段落。)
|
XWPFParagraph |
getParagraphArray(int pos)
Returns the paragraph that of position pos
(返回位置 pos 的段落)
|
int |
getParagraphPos(int pos)
Look up the paragraph at the specified position in the body elements list and return this paragraphs position in the paragraphs list
(在正文元素列表中查找指定位置的段落,并返回该段落在段落列表中的位置)
|
java.util.List<XWPFParagraph> |
getParagraphs()
Returns the paragraph(s) that holds the text of the header or footer.
(返回包含页眉或页脚文本的段落。)
|
java.util.Iterator<XWPFParagraph> |
getParagraphsIterator() |
POIXMLDocumentPart |
getPart()
returns the Part, to which the body belongs, which you need for adding relationship to other parts Actually it is needed of the class XWPFTableCell.
(返回主体所属的部分,您需要添加与其他部分的关系实际上它是类 XWPFTableCell 所需要的。)
|
PackagePart |
getPartById(java.lang.String id)
Get the document part that's defined as the given relationship of the core document.
(获取定义为核心文档的给定关系的文档部分。)
|
BodyType |
getPartType()
get the PartType of the body, for example DOCUMENT, HEADER, FOOTER, FOOTNOTE,
(获取正文的 PartType,例如 DOCUMENT、HEADER、FOOTER、FOOTNOTE、)
|
XWPFPictureData |
getPictureDataByID(java.lang.String blipID)
returns the PictureData by blipID
(通过 blipID 返回 PictureData)
|
int |
getPosOfParagraph(XWPFParagraph p)
Get the position of the paragraph, within the list of all the body elements.
(获取段落在所有正文元素列表中的位置。)
|
int |
getPosOfTable(XWPFTable t)
Get the position of the table, within the list of all the body elements.
(在所有正文元素的列表中获取表格的位置。)
|
org.openxmlformats.schemas.wordprocessingml.x2006.main.CTStyles |
getStyle()
Returns the styles object used
(返回使用的样式对象)
|
XWPFStyles |
getStyles()
get Styles
(获取样式)
|
XWPFTable |
getTable(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl ctTbl)
get a table by its CTTbl-Object
(通过其 CTTbl-Object 获取表)
|
XWPFTable |
getTableArray(int pos)
Returns the table at position pos
(返回位置 pos 的表)
|
XWPFTableCell |
getTableCell(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc cell)
get the TableCell which belongs to the TableCell
(获取属于 TableCell 的 TableCell)
|
int |
getTablePos(int pos)
get with the position of a table in the bodyelement array list the position of this table in the table array list
(获取表格在bodyelement数组列表中的位置该表格在表格数组列表中的位置)
|
java.util.List<XWPFTable> |
getTables()
Return the table(s) that holds the text of the IBodyPart, for complex cases where a paragraph isn't used.
(对于不使用段落的复杂情况,返回包含 IBodyPart 文本的表。)
|
java.util.Iterator<XWPFTable> |
getTablesIterator() |
java.lang.String |
getTblStyle(XWPFTable table) |
XWPFDocument |
getXWPFDocument()
Return XWPFDocument
(返回 XWPF 文档)
|
long |
getZoomPercent()
Returns the current zoom factor in percent values, i.e.
(以百分比值返回当前缩放因子,即)
|
XWPFParagraph |
insertNewParagraph(org.apache.xmlbeans.XmlCursor cursor)
Add a new paragraph at position of the cursor.
(在光标位置添加一个新段落。)
|
XWPFTable |
insertNewTbl(org.apache.xmlbeans.XmlCursor cursor)
inserts a new Table at the cursor position.
(在光标位置插入一个新表。)
|
void |
insertTable(int pos, XWPFTable table)
inserts an existing XWPFTable to the arrays bodyElements and tables
(将现有的 XWPFTable 插入到数组 bodyElements 和表中)
|
boolean |
isEnforcedCommentsProtection()
Verifies that the documentProtection tag in settings.xml file
specifies that the protection is enforced (w:enforcement="1") and that the kind of protection is comments (w:edit="comments") sample snippet from settings.xml (验证 settings.xml 文件中的 documentProtection 标记是否指定强制执行保护 (w:enforcement="1") 并且保护类型是来自 settings.xml 的注释 (w:edit="comments") 示例片段) |
boolean |
isEnforcedFillingFormsProtection()
Verifies that the documentProtection tag in settings.xml file
specifies that the protection is enforced (w:enforcement="1") and that the kind of protection is forms (w:edit="forms") sample snippet from settings.xml (验证 settings.xml 文件中的 documentProtection 标记是否指定强制执行保护 (w:enforcement="1") 并且保护类型是来自 settings.xml 的表单 (w:edit="forms") 示例片段) |
boolean |
isEnforcedProtection()
Verifies that the documentProtection tag in settings.xml file
specifies that the protection is enforced (w:enforcement="1") sample snippet from settings.xml (验证 settings.xml 文件中的 documentProtection 标记是否指定强制执行保护 (w:enforcement="1") 来自 settings.xml 的示例片段) |
boolean |
isEnforcedReadonlyProtection()
Verifies that the documentProtection tag in settings.xml file
specifies that the protection is enforced (w:enforcement="1") and that the kind of protection is readOnly (w:edit="readOnly") sample snippet from settings.xml (验证 settings.xml 文件中的 documentProtection 标记是否指定强制执行保护 (w:enforcement="1") 并且保护类型为只读 (w:edit="readOnly") 来自 settings.xml 的示例片段) |
boolean |
isEnforcedTrackedChangesProtection()
Verifies that the documentProtection tag in settings.xml file
specifies that the protection is enforced (w:enforcement="1") and that the kind of protection is trackedChanges (w:edit="trackedChanges") sample snippet from settings.xml (验证 settings.xml 文件中的 documentProtection 标记是否指定强制执行保护 (w:enforcement="1") 并且保护类型是 trackedChanges (w:edit="trackedChanges") 来自 settings.xml 的示例片段) |
boolean |
isEnforcedUpdateFields() |
boolean |
isTrackRevisions()
Check if revision tracking is turned on.
(检查修订跟踪是否打开。)
|
protected static OPCPackage |
newPackage()
Create a new WordProcessingML package and setup the default minimal content
(创建一个新的 WordProcessingML 包并设置默认的最小内容)
|
protected void |
onDocumentCreate()
Create a new CTWorkbook with all values set to default
(创建一个新的 CTWorkbook 并将所有值设置为默认值)
|
protected void |
onDocumentRead()
Fired when a package part is read
(读取包部分时触发)
|
boolean |
removeBodyElement(int pos)
remove a BodyElement from bodyElements array list
(从 bodyElements 数组列表中删除 BodyElement)
|
boolean |
removeEndnote(int pos)
Remove the specified end note if present.
(如果存在,请删除指定的尾注。)
|
boolean |
removeFootnote(int pos)
Remove the specified footnote if present.
(删除指定的脚注(如果存在)。)
|
void |
removeProtectionEnforcement()
Remove 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 |
setEvenAndOddHeadings(boolean enable)
Sets the even-and-odd-headings setting
(设置偶数和奇数标题设置)
|
void |
setMirrorMargins(boolean enable)
Sets the mirror margins setting
(设置镜像边距设置)
|
void |
setParagraph(XWPFParagraph paragraph, int pos)
copies content of a paragraph to a existing paragraph in the list paragraphs at position pos
(将段落的内容复制到位置 pos 的列表段落中的现有段落)
|
void |
setTable(int pos, XWPFTable table)
Replace content of table in array tables at position pos with a
(将位置 pos 的数组表中的表的内容替换为)
|
void |
setTrackRevisions(boolean enable)
Enable or disable revision tracking.
(启用或禁用修订跟踪。)
|
void |
setZoomPercent(long zoomPercent)
Set the zoom setting as percent value, i.e.
(将缩放设置设置为百分比值,即)
|
boolean |
validateProtectionPassword(java.lang.String password)
Validates the existing password
(验证现有密码)
|
close, getCorePart, getPackage, getProperties, getRelatedByType, load, openPackage, write
_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, getTargetPart, isCommitted, onDocumentRemove, onSave, prepareForCommit, read, rebase, removeRelation, removeRelation, removeRelation, setCommitted, toString
protected java.util.List<XWPFFooter> footers
protected java.util.List<XWPFHeader> headers
protected java.util.List<XWPFComment> comments
protected java.util.List<XWPFHyperlink> hyperlinks
protected java.util.List<XWPFParagraph> paragraphs
protected java.util.List<XWPFTable> tables
protected java.util.List<XWPFSDT> contentControls
protected java.util.List<IBodyElement> bodyElements
protected java.util.List<XWPFPictureData> pictures
protected java.util.Map<java.lang.Long,java.util.List<XWPFPictureData>> packagePictures
protected XWPFEndnotes endnotes
protected XWPFNumbering numbering
protected XWPFStyles styles
protected XWPFFootnotes footnotes
protected final java.util.List<XWPFChart> charts
public XWPFDocument(OPCPackage pkg) throws java.io.IOException
java.io.IOException
(java.io.IOException)
public XWPFDocument(java.io.InputStream is) throws java.io.IOException
java.io.IOException
(java.io.IOException)
public XWPFDocument()
protected static OPCPackage newPackage()
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)
protected void onDocumentCreate()
onDocumentCreate
in class
POIXMLDocumentPart
@Internal public org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDocument1 getDocument()
public java.util.List<IBodyElement> getBodyElements()
getBodyElements
in interface
IBody
(接口 IBody 中的 getBodyElements)
IBody.getBodyElements()
public java.util.Iterator<IBodyElement> getBodyElementsIterator()
public java.util.List<XWPFParagraph> getParagraphs()
IBody
getParagraphs
in interface
IBody
(接口 IBody 中的 getParagraphs)
IBody.getParagraphs()
public java.util.List<XWPFTable> getTables()
IBody
getTables
in interface
IBody
(接口 IBody 中的 getTables)
IBody.getTables()
public java.util.List<XWPFChart> getCharts()
public XWPFTable getTableArray(int pos)
IBody
getTableArray
in interface
IBody
(接口 IBody 中的 getTableArray)
IBody.getTableArray(int)
public java.util.List<XWPFFooter> getFooterList()
public XWPFFooter getFooterArray(int pos)
public java.util.List<XWPFHeader> getHeaderList()
public XWPFHeader getHeaderArray(int pos)
public java.lang.String getTblStyle(XWPFTable table)
public XWPFHyperlink getHyperlinkByID(java.lang.String id)
public XWPFFootnote getFootnoteByID(int id)
public XWPFEndnote getEndnoteByID(int id)
public java.util.List<XWPFFootnote> getFootnotes()
public XWPFHyperlink[] getHyperlinks()
public XWPFComment getCommentByID(java.lang.String id)
public XWPFComment[] getComments()
public PackagePart getPartById(java.lang.String id)
public XWPFHeaderFooterPolicy getHeaderFooterPolicy()
public XWPFHeaderFooterPolicy createHeaderFooterPolicy()
public XWPFHeader createHeader(HeaderFooterType type)
type
-
HeaderFooterType
enum
(类型 - HeaderFooterType 枚举)
XWPFHeader
(XWPFHeader 类型的对象)
public XWPFFooter createFooter(HeaderFooterType type)
type
-
HeaderFooterType
enum
(类型 - HeaderFooterType 枚举)
XWPFFooter
(XWPFFooter 类型的对象)
@Internal public org.openxmlformats.schemas.wordprocessingml.x2006.main.CTStyles getStyle() throws org.apache.xmlbeans.XmlException, java.io.IOException
org.apache.xmlbeans.XmlException
(org.apache.xmlbeans.XmlException)
java.io.IOException
(java.io.IOException)
public java.util.List<PackagePart> getAllEmbeddedParts() throws OpenXML4JException
getAllEmbeddedParts
in class
POIXMLDocument
(类 POIXMLDocument 中的 getAllEmbeddedParts)
OpenXML4JException
- if the embedded parts can't be determined
(OpenXML4JException - 如果无法确定嵌入的部分)
public int getParagraphPos(int pos)
pos
- The position of the relevant paragraph in the body elements list
(pos - 相关段落在正文元素列表中的位置)
public int getTablePos(int pos)
pos
- position of the table in the bodyelement array list
(pos - 表格在 bodyelement 数组列表中的位置)
public XWPFParagraph insertNewParagraph(org.apache.xmlbeans.XmlCursor cursor)
XmlCursor.TokenType.START
tag of an subelement of the documents body. When this method is done, the cursor passed as parameter points to the
XmlCursor.TokenType.END
of the newly inserted paragraph.
(在光标位置添加一个新段落。光标必须位于文档正文子元素的 XmlCursor.TokenType.START 标记上。完成此方法后,作为参数传递的光标指向新插入段落的 XmlCursor.TokenType.END。)
insertNewParagraph
in interface
IBody
(接口 IBody 中的 insertNewParagraph)
cursor
- The cursor-position where the new paragraph should be added.
(cursor - 应该添加新段落的光标位置。)
XWPFParagraph
object representing the newly inserted CTP object
(表示新插入的 CTP 对象的 XWPFParagraph 对象)
public XWPFTable insertNewTbl(org.apache.xmlbeans.XmlCursor cursor)
IBody
insertNewTbl
in interface
IBody
(接口 IBody 中的 insertNewTbl)
public int getPosOfParagraph(XWPFParagraph p)
p
- The paragraph to find
(p - 要查找的段落)
public int getPosOfTable(XWPFTable t)
t
- The table to find
(t - 要查找的表)
protected void commit() throws java.io.IOException
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 XWPFParagraph createParagraph()
public XWPFNumbering createNumbering()
public XWPFStyles createStyles()
public XWPFFootnotes createFootnotes()
@Internal public XWPFFootnote addFootnote(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn note)
note
- CTFtnEnd to be added.
(注意 - 要添加的 CTFtnEnd。)
XWPFFootnote
(新 XWPF 脚注)
@Internal public XWPFEndnote addEndnote(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn note)
note
- CTFtnEnd to be added.
(注意 - 要添加的 CTFtnEnd。)
XWPFEndnote
(新 XWPF 尾注)
public boolean removeBodyElement(int pos)
pos
-
(邮政 -)
public void setParagraph(XWPFParagraph paragraph, int pos)
paragraph
-
(段落 -)
pos
-
(邮政 -)
public XWPFParagraph getLastParagraph()
public XWPFTable createTable()
public XWPFTable createTable(int rows, int cols)
rows
-
(行 -)
cols
-
(衣领 -)
public void createTOC()
public void setTable(int pos, XWPFTable table)
pos
-
(邮政 -)
table
-
(桌子 -)
public boolean isEnforcedProtection()
<w:settings ... > <w:documentProtection w:edit="readOnly" w:enforcement="1"/>(验证 settings.xml 文件中的 documentProtection 标记是否指定强制执行保护 (w:enforcement="1") 来自 settings.xml 的示例片段
public boolean isEnforcedReadonlyProtection()
<w:settings ... > <w:documentProtection w:edit="readOnly" w:enforcement="1"/>(验证 settings.xml 文件中的 documentProtection 标记是否指定强制执行保护 (w:enforcement="1") 并且保护类型为只读 (w:edit="readOnly") 来自 settings.xml 的示例片段
public boolean isEnforcedFillingFormsProtection()
<w:settings ... > <w:documentProtection w:edit="forms" w:enforcement="1"/>(验证 settings.xml 文件中的 documentProtection 标记是否指定强制执行保护 (w:enforcement="1") 并且保护类型是来自 settings.xml 的表单 (w:edit="forms") 示例片段
public boolean isEnforcedCommentsProtection()
<w:settings ... > <w:documentProtection w:edit="comments" w:enforcement="1"/>(验证 settings.xml 文件中的 documentProtection 标记是否指定强制执行保护 (w:enforcement="1") 并且保护类型是来自 settings.xml 的注释 (w:edit="comments") 示例片段
public boolean isEnforcedTrackedChangesProtection()
<w:settings ... > <w:documentProtection w:edit="trackedChanges" w:enforcement="1"/>(验证 settings.xml 文件中的 documentProtection 标记是否指定强制执行保护 (w:enforcement="1") 并且保护类型是 trackedChanges (w:edit="trackedChanges") 来自 settings.xml 的示例片段
public boolean isEnforcedUpdateFields()
public void enforceReadonlyProtection()
<w:settings ... > <w:documentProtection w:edit="readOnly" w:enforcement="1"/>(强制执行只读保护。在 settings.xml 文件内的 documentProtection 标记中,它将强制值设置为“1”(w:enforcement="1"),并将编辑值设置为只读(w:edit="readOnly")示例片段。 xml
public void enforceReadonlyProtection(java.lang.String password, HashAlgorithm hashAlgo)
<w:documentProtection w:edit="readOnly" w:enforcement="1" w:cryptProviderType="rsaAES" w:cryptAlgorithmClass="hash" w:cryptAlgorithmType="typeAny" w:cryptAlgorithmSid="14" w:cryptSpinCount="100000" w:hash="..." w:salt="...." />(使用密码强制执行只读保护。来自 settings.xml 的示例片段
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 void enforceFillingFormsProtection()
<w:settings ... > <w:documentProtection w:edit="forms" w:enforcement="1"/>(强制填写表格保护。在 settings.xml 文件中的 documentProtection 标记中,它将强制值设置为“1”(w:enforcement="1"),并将编辑值设置为表单(w:edit="forms")示例片段。 xml
public void enforceFillingFormsProtection(java.lang.String password, HashAlgorithm hashAlgo)
<w:documentProtection w:edit="forms" w:enforcement="1" w:cryptProviderType="rsaAES" w:cryptAlgorithmClass="hash" w:cryptAlgorithmType="typeAny" w:cryptAlgorithmSid="14" w:cryptSpinCount="100000" w:hash="..." w:salt="...." />(强制填写表格保护。来自 settings.xml 的示例片段
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 void enforceCommentsProtection()
<w:settings ... > <w:documentProtection w:edit="comments" w:enforcement="1"/>(强制执行评论保护。在 settings.xml 文件中的 documentProtection 标记中,它将强制值设置为“1”(w:enforcement="1"),并将编辑值设置为注释(w:edit="comments")示例片段。 xml
public void enforceCommentsProtection(java.lang.String password, HashAlgorithm hashAlgo)
<w:documentProtection w:edit="comments" w:enforcement="1" w:cryptProviderType="rsaAES" w:cryptAlgorithmClass="hash" w:cryptAlgorithmType="typeAny" w:cryptAlgorithmSid="14" w:cryptSpinCount="100000" w:hash="..." w:salt="...." />(强制执行评论保护。来自 settings.xml 的示例片段
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 void enforceTrackedChangesProtection()
<w:settings ... > <w:documentProtection w:edit="trackedChanges" w:enforcement="1"/>(实施跟踪更改保护。在 settings.xml 文件中的 documentProtection 标记中,它将强制值设置为“1”(w:enforcement="1"),并将编辑值设置为 trackedChanges(w:edit="trackedChanges")示例片段。 xml
public void enforceTrackedChangesProtection(java.lang.String password, HashAlgorithm hashAlgo)
<w:documentProtection w:edit="trackedChanges" w:enforcement="1" w:cryptProviderType="rsaAES" w:cryptAlgorithmClass="hash" w:cryptAlgorithmType="typeAny" w:cryptAlgorithmSid="14" w:cryptSpinCount="100000" w:hash="..." w:salt="...." />(实施跟踪更改保护。来自 settings.xml 的示例片段
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
-
(密码 -)
public void removeProtectionEnforcement()
public void enforceUpdateFields()
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 关闭修订跟踪)
public long getZoomPercent()
public void setZoomPercent(long zoomPercent)
zoomPercent
- A percent value denoting the zoom setting for this document.
(zoomPercent - 一个百分比值,表示此文档的缩放设置。)
public boolean getEvenAndOddHeadings()
public void setEvenAndOddHeadings(boolean enable)
enable
- Set to true to turn on separate even and odd headings.
(enable - 设置为 true 以打开单独的偶数和奇数标题。)
public boolean getMirrorMargins()
public void setMirrorMargins(boolean enable)
enable
- Set to true to turn on mirror margins.
(enable - 设置为 true 以打开镜像边距。)
public void insertTable(int pos, XWPFTable table)
insertTable
in interface
IBody
(接口 IBody 中的 insertTable)
pos
-
(邮政 -)
table
-
(桌子 -)
public java.util.List<XWPFPictureData> getAllPictures()
List
of
XWPFPictureData
. The returned
List
is unmodifiable. Use #a
(XWPFPictureData 列表。返回的 List 是不可修改的。用一个)
public java.util.List<XWPFPictureData> getAllPackagePictures()
public java.lang.String addPictureData(byte[] pictureData, int format) throws InvalidFormatException
InvalidFormatException
(无效格式异常)
public java.lang.String addPictureData(java.io.InputStream is, int format) throws InvalidFormatException
InvalidFormatException
(无效格式异常)
public int getNextPicNameNumber(int format) throws InvalidFormatException
format
-
(格式 -)
InvalidFormatException
- If the format of the picture is not known.
(InvalidFormatException - 如果图片的格式未知。)
public XWPFPictureData getPictureDataByID(java.lang.String blipID)
blipID
-
(blipID -)
public XWPFNumbering getNumbering()
public XWPFStyles getStyles()
public XWPFParagraph getParagraph(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP p)
IBody
CTP
.
(返回与提供的 CTP 对应的段落。)
getParagraph
in interface
IBody
(接口 IBody 中的 getParagraph)
p
- is instance of CTP and is searching for an XWPFParagraph
(p - 是 CTP 的实例,正在搜索 XWPFParagraph)
CTP
, or
null
if there is no corresponding paragraph in this body.
(与 CTP 对应的段落,如果此正文中没有对应的段落,则为 null。)
public XWPFTable getTable(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl ctTbl)
getTable
in interface
IBody
(接口 IBody 中的 getTable)
ctTbl
-
(ctTbl-)
IBody.getTable(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl)
public java.util.Iterator<XWPFTable> getTablesIterator()
public java.util.Iterator<XWPFParagraph> getParagraphsIterator()
public XWPFParagraph getParagraphArray(int pos)
getParagraphArray
in interface
IBody
(接口 IBody 中的 getParagraphArray)
IBody.getParagraphArray(int)
public POIXMLDocumentPart getPart()
getPart
in interface
IBody
(接口 IBody 中的 getPart)
IBody.getPart()
public BodyType getPartType()
getPartType
in interface
IBody
(接口 IBody 中的 getPartType)
IBody.getPartType()
public XWPFTableCell getTableCell(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc cell)
getTableCell
in interface
IBody
(接口 IBody 中的 getTableCell)
cell
-
(细胞 -)
public XWPFDocument getXWPFDocument()
IBody
getXWPFDocument
in interface
IBody
(接口 IBody 中的 getXWPFDocument)
public XWPFChart createChart() throws InvalidFormatException, java.io.IOException
InvalidFormatException
(无效格式异常)
java.io.IOException
(java.io.IOException)
public XWPFChart createChart(int width, int height) throws InvalidFormatException, java.io.IOException
width
- width of chart in document
(width - 文档中图表的宽度)
height
- height of chart in document
(height - 文档中图表的高度)
InvalidFormatException
(无效格式异常)
java.io.IOException
(java.io.IOException)
public XWPFChart createChart(XWPFRun run, int width, int height) throws InvalidFormatException, java.io.IOException
run
- in which the chart will be attached.
(运行 - 将在其中附加图表。)
width
- in EMU.
(宽度 - 在 EMU 中。)
height
- in EMU.
(高度 - 在 EMU 中。)
InvalidFormatException
(无效格式异常)
java.io.IOException
(java.io.IOException)
public XWPFFootnote createFootnote()
public boolean removeFootnote(int pos)
pos
- Array position of the footnote to be removed.
(pos - 要删除的脚注的数组位置。)
public XWPFEndnote createEndnote()
XWPFEndnote
.
(新的 XWPF 尾注。)
public XWPFEndnotes createEndnotes()
public java.util.List<XWPFEndnote> getEndnotes()
XWPFEndnote
s.
(XWPFEndnotes 的列表,可能为空。)
public boolean removeEndnote(int pos)
pos
- Array position of the end note to be removed.
(pos - 要删除的尾注的数组位置。)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.