public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBody
POIXMLDocumentPart.RelationPart
Modifier | Constructor and Description |
---|---|
protected |
XWPFHeaderFooter() |
|
XWPFHeaderFooter(POIXMLDocumentPart parent, PackagePart part) |
Modifier and Type | Method and Description |
---|---|
org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHdrFtr |
_getHdrFtr() |
java.lang.String |
addPictureData(byte[] pictureData, int format)
Adds a picture to the document.
(在文档中添加图片。)
|
java.lang.String |
addPictureData(java.io.InputStream is, int format)
Adds a picture to the document.
(在文档中添加图片。)
|
void |
clearHeaderFooter()
Clears all paragraphs and tables from this header / footer
(清除此页眉/页脚中的所有段落和表格)
|
XWPFParagraph |
createParagraph()
Adds a new paragraph at the end of the header or footer
(在页眉或页脚的末尾添加一个新段落)
|
XWPFTable |
createTable(int rows, int cols)
Adds a new table at the end of the header or footer
(在页眉或页脚的末尾添加一个新表格)
|
java.util.List<XWPFPictureData> |
getAllPackagePictures()
get all Pictures in this package
(获取此包中的所有图片)
|
java.util.List<XWPFPictureData> |
getAllPictures() |
java.util.List<IBodyElement> |
getBodyElements()
Returns an Iterator with paragraphs and tables, in the order that they occur in the text.
(返回具有段落和表格的迭代器,按照它们在文本中出现的顺序。)
|
java.util.List<XWPFParagraph> |
getListParagraph()
get a List of all Paragraphs
(获取所有段落的列表)
|
POIXMLDocumentPart |
getOwner() |
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 holds the text of the header or footer.
(返回包含页眉或页脚文本的段落。)
|
java.util.List<XWPFParagraph> |
getParagraphs()
Returns the paragraph(s) that holds the text of the header or footer.
(返回包含页眉或页脚文本的段落。)
|
POIXMLDocumentPart |
getPart()
returns the Part, to which the body belongs, which you need for adding relationship to other parts
(返回 body 所属的 Part,您需要添加与其他部分的关系)
|
XWPFPictureData |
getPictureDataByID(java.lang.String blipID)
returns the PictureData by blipID
(通过 blipID 返回 PictureData)
|
XWPFTable |
getTable(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl ctTable)
|
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)
|
java.util.List<XWPFTable> |
getTables()
Return the table(s) that holds the text of the header or footer, for complex cases where a paragraph isn't used.
(对于不使用段落的复杂情况,返回包含页眉或页脚文本的表格。)
|
java.lang.String |
getText()
Returns the textual content of the header/footer, by flattening out the text of its paragraph(s)
(通过展平段落的文本,返回页眉/页脚的文本内容)
|
XWPFDocument |
getXWPFDocument()
Return XWPFDocument
(返回 XWPF 文档)
|
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 和表中)
|
protected void |
onDocumentRead()
Fired when a package part is read
(读取包部分时触发)
|
protected void |
prepareForCommit()
Ensure that a memory based package part does not have lingering data from previous commit() calls.
(确保基于内存的包部分没有来自先前 commit() 调用的延迟数据。)
|
void |
readHdrFtr() |
void |
removeParagraph(XWPFParagraph paragraph)
Removes a specific paragraph from this header / footer
(从此页眉/页脚中删除特定段落)
|
void |
removeTable(XWPFTable table)
Removes a specific table from this header / footer
(从此页眉/页脚中删除特定表格)
|
void |
setHeaderFooter(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHdrFtr headerFooter)
set a new headerFooter
(设置一个新的 headerFooter)
|
void |
setXWPFDocument(XWPFDocument doc) |
_invokeOnDocumentRead, addRelation, commit, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, getTargetPart, isCommitted, onDocumentCreate, onDocumentRemove, onSave, read, rebase, removeRelation, removeRelation, removeRelation, setCommitted, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getPartType
protected XWPFHeaderFooter()
public XWPFHeaderFooter(POIXMLDocumentPart parent, PackagePart part)
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)
@Internal public org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHdrFtr _getHdrFtr()
public java.util.List<IBodyElement> getBodyElements()
IBody
getBodyElements
in interface
IBody
(接口 IBody 中的 getBodyElements)
public java.util.List<XWPFParagraph> getParagraphs()
getParagraphs
in interface
IBody
(接口 IBody 中的 getParagraphs)
public java.util.List<XWPFTable> getTables() throws java.lang.ArrayIndexOutOfBoundsException
public java.lang.String getText()
public void setHeaderFooter(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTHdrFtr headerFooter)
public XWPFTable getTable(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl ctTable)
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 XWPFParagraph getParagraphArray(int pos)
getParagraphArray
in interface
IBody
(接口 IBody 中的 getParagraphArray)
public java.util.List<XWPFParagraph> getListParagraph()
XWPFParagraph
(XWPFP 段落列表)
public java.util.List<XWPFPictureData> getAllPictures()
public java.util.List<XWPFPictureData> getAllPackagePictures()
public java.lang.String addPictureData(byte[] pictureData, int format) throws InvalidFormatException
pictureData
- The picture data
(pictureData - 图片数据)
format
- The format of the picture.
(format - 图片的格式。)
getAllPictures()
.
(该图片的索引(从0开始),添加的图片可以从getAllPictures()中获得。)
InvalidFormatException
- If the format of the picture is not known.
(InvalidFormatException - 如果图片的格式未知。)
public java.lang.String addPictureData(java.io.InputStream is, int format) throws InvalidFormatException, java.io.IOException
is
- The stream to read image from
(is - 要从中读取图像的流)
format
- The format of the picture.
(format - 图片的格式。)
getAllPictures()
.
(该图片的索引(从0开始),添加的图片可以从getAllPictures()中获得。)
InvalidFormatException
- If the format of the picture is not known.
(InvalidFormatException - 如果图片的格式未知。)
java.io.IOException
- If reading the picture-data from the stream fails.
(java.io.IOException - 如果从流中读取图片数据失败。)
public XWPFPictureData getPictureDataByID(java.lang.String blipID)
blipID
-
(blipID -)
java.lang.Exception
(java.lang.异常)
public XWPFParagraph createParagraph()
XWPFParagraph
object
(新的 XWPFParagraph 对象)
public XWPFTable createTable(int rows, int cols)
rows
- - number of rows in the table
(rows -- 表中的行数)
cols
- - number of columns in the table
(cols - 表格中的列数)
XWPFTable
object
(新的 XWPFTable 对象)
public void removeParagraph(XWPFParagraph paragraph)
paragraph
- -
XWPFParagraph
object to remove
(段落 - - 要删除的 XWPFParagraph 对象)
public void removeTable(XWPFTable table)
table
- -
XWPFTable
object to remove
(table - - 要删除的 XWPFTable 对象)
public void clearHeaderFooter()
public XWPFParagraph insertNewParagraph(org.apache.xmlbeans.XmlCursor cursor)
insertNewParagraph
in interface
IBody
(接口 IBody 中的 insertNewParagraph)
cursor
-
(光标 -)
public XWPFTable insertNewTbl(org.apache.xmlbeans.XmlCursor cursor)
IBody
insertNewTbl
in interface
IBody
(接口 IBody 中的 insertNewTbl)
cursor
-
(光标 -)
public POIXMLDocumentPart getOwner()
public XWPFTable getTableArray(int pos)
getTableArray
in interface
IBody
(接口 IBody 中的 getTableArray)
IBody.getTableArray(int)
public void insertTable(int pos, XWPFTable table)
insertTable
in interface
IBody
(接口 IBody 中的 insertTable)
pos
-
(邮政 -)
table
-
(桌子 -)
public void readHdrFtr()
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 void setXWPFDocument(XWPFDocument doc)
public POIXMLDocumentPart getPart()
getPart
in interface
IBody
(接口 IBody 中的 getPart)
IBody.getPart()
protected void prepareForCommit()
POIXMLDocumentPart
Note: This is overwritten for some objects, as *PictureData seem to store the actual content in the part directly without keeping a copy like all others therefore we need to handle them differently.
(确保基于内存的包部分没有来自先前 commit() 调用的延迟数据。注意:这对于某些对象被覆盖,因为 *PictureData 似乎直接将实际内容存储在部件中,而不像所有其他对象一样保留副本,因此我们需要以不同的方式处理它们。)prepareForCommit
in class
POIXMLDocumentPart
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.