Package org.apache.poi.xwpf.usermodel
Interface IBody
-
- All Known Implementing Classes:
XWPFAbstractFootnoteEndnote
,XWPFDocument
,XWPFEndnote
,XWPFFooter
,XWPFFootnote
,XWPFHeader
,XWPFHeaderFooter
,XWPFTableCell
public interface IBody
An IBody represents the different parts of the document which can contain collections of Paragraphs and Tables. It provides a common way to work with these and their contents.
Typically, this is something like a XWPFDocument, or one of the parts in it like XWPFHeader, XWPFFooter, XWPFTableCell
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.List<IBodyElement>
getBodyElements()
Returns an Iterator with paragraphs and tables, in the order that they occur in the text.XWPFParagraph
getParagraph(CTP p)
if there is a correspondingXWPFParagraph
of the parameter ctTable in the paragraphList of this header or footer the method will return this paragraph if there is no correspondingXWPFParagraph
the method will return nullXWPFParagraph
getParagraphArray(int pos)
Returns the paragraph that of position posjava.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 Actually it is needed of the class XWPFTableCell.BodyType
getPartType()
get the PartType of the body, for example DOCUMENT, HEADER, FOOTER, FOOTNOTE,XWPFTable
getTable(CTTbl ctTable)
XWPFTable
getTableArray(int pos)
Returns the table at position posXWPFTableCell
getTableCell(CTTc cell)
returns the TableCell to which the Table belongsjava.util.List<XWPFTable>
getTables()
Return the table(s) that holds the text of the IBodyPart, for complex cases where a paragraph isn't used.XWPFDocument
getXWPFDocument()
Return XWPFDocumentXWPFParagraph
insertNewParagraph(XmlCursor cursor)
inserts a new paragraph at position of the cursorXWPFTable
insertNewTbl(XmlCursor cursor)
inserts a new Table at the cursor position.void
insertTable(int pos, XWPFTable table)
inserts a new Table at position pos
-
-
-
Method Detail
-
getPart
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. Because you have to know to which part the tableCell belongs.- Returns:
- the Part, to which the body belongs
-
getPartType
BodyType getPartType()
get the PartType of the body, for example DOCUMENT, HEADER, FOOTER, FOOTNOTE,- Returns:
- the PartType of the body
-
getBodyElements
java.util.List<IBodyElement> getBodyElements()
Returns an Iterator with paragraphs and tables, in the order that they occur in the text.
-
getParagraphs
java.util.List<XWPFParagraph> getParagraphs()
Returns the paragraph(s) that holds the text of the header or footer.
-
getTables
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.
-
getParagraph
XWPFParagraph getParagraph(CTP p)
if there is a correspondingXWPFParagraph
of the parameter ctTable in the paragraphList of this header or footer the method will return this paragraph if there is no correspondingXWPFParagraph
the method will return null- Parameters:
p
- is instance of CTP and is searching for an XWPFParagraph- Returns:
- null if there is no XWPFParagraph with an corresponding CTPparagraph in the paragraphList of this header or footer XWPFParagraph with the correspondig CTP p
-
getTable
XWPFTable getTable(CTTbl ctTable)
if there is a correspondingXWPFTable
of the parameter ctTable in the tableList of this header the method will return this table if there is no correspondingXWPFTable
the method will return null- Parameters:
ctTable
-
-
getParagraphArray
XWPFParagraph getParagraphArray(int pos)
Returns the paragraph that of position pos
-
getTableArray
XWPFTable getTableArray(int pos)
Returns the table at position pos
-
insertNewParagraph
XWPFParagraph insertNewParagraph(XmlCursor cursor)
inserts a new paragraph at position of the cursor- Parameters:
cursor
-
-
insertNewTbl
XWPFTable insertNewTbl(XmlCursor cursor)
inserts a new Table at the cursor position.- Parameters:
cursor
-
-
insertTable
void insertTable(int pos, XWPFTable table)
inserts a new Table at position pos- Parameters:
pos
-table
-
-
getTableCell
XWPFTableCell getTableCell(CTTc cell)
returns the TableCell to which the Table belongs- Parameters:
cell
-
-
getXWPFDocument
XWPFDocument getXWPFDocument()
Return XWPFDocument
-
-