Package org.apache.poi.xwpf.usermodel
Interface IBody
- All Known Implementing Classes:
XWPFAbstractFootnoteEndnote,XWPFComment,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
Modifier and TypeMethodDescriptionReturns an Iterator with paragraphs and tables, in the order that they occur in the text.getParagraph(CTP p) Returns the paragraph corresponding to the providedCTP.getParagraphArray(int pos) Returns the paragraph that of position posReturns the paragraph(s) that holds the text of the header or footer.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.get the PartType of the body, for example DOCUMENT, HEADER, FOOTER, FOOTNOTE,getTableArray(int pos) Returns the table at position posgetTableCell(CTTc cell) returns the TableCell to which the Table belongsReturn the table(s) that holds the text of the IBodyPart, for complex cases where a paragraph isn't used.Return XWPFDocumentinsertNewParagraph(XmlCursor cursor) inserts a new paragraph at position of the cursorinsertNewTbl(XmlCursor cursor) inserts a new Table at the cursor position.voidinsertTable(int pos, XWPFTable table) inserts a new Table at position pos
-
Method Details
-
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
List<IBodyElement> getBodyElements()Returns an Iterator with paragraphs and tables, in the order that they occur in the text. -
getParagraphs
List<XWPFParagraph> getParagraphs()Returns the paragraph(s) that holds the text of the header or footer. -
getTables
Return the table(s) that holds the text of the IBodyPart, for complex cases where a paragraph isn't used. -
getParagraph
Returns the paragraph corresponding to the providedCTP.- Parameters:
p- is instance of CTP and is searching for an XWPFParagraph- Returns:
- The paragraph corresponding to the
CTP, ornullif there is no corresponding paragraph in this body.
-
getTable
-
getParagraphArray
Returns the paragraph that of position pos -
getTableArray
Returns the table at position pos -
insertNewParagraph
inserts a new paragraph at position of the cursor -
insertNewTbl
inserts a new Table at the cursor position. -
insertTable
inserts a new Table at position pos -
getTableCell
returns the TableCell to which the Table belongs -
getXWPFDocument
XWPFDocument getXWPFDocument()Return XWPFDocument
-