Package org.apache.poi.xwpf.usermodel
Class XWPFAbstractFootnoteEndnote
- java.lang.Object
-
- org.apache.poi.xwpf.usermodel.XWPFAbstractFootnoteEndnote
-
- All Implemented Interfaces:
java.lang.Iterable<XWPFParagraph>,IBody
- Direct Known Subclasses:
XWPFEndnote,XWPFFootnote
public abstract class XWPFAbstractFootnoteEndnote extends java.lang.Object implements java.lang.Iterable<XWPFParagraph>, IBody
Base class for both bottom-of-the-page footnotesXWPFFootnoteand end notesXWPFEndnote).The only significant difference between footnotes and end notes is which part they go on. Footnotes are managed by the Footnotes part
XWPFFootnotesand end notes are managed by the Endnotes partXWPFEndnotes.- Since:
- 4.0.0
-
-
Constructor Summary
Constructors Constructor Description XWPFAbstractFootnoteEndnote()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description XWPFParagraphaddNewParagraph(CTP paragraph)Add a newXWPFParagraphto the end of the footnote.XWPFTableaddNewTbl(CTTbl table)Add a newXWPFTableto the end of the footnote.XWPFParagraphcreateParagraph()Appends a newXWPFParagraphto this footnote.XWPFTablecreateTable()Appends a newXWPFTableto this footnoteXWPFTablecreateTable(int rows, int cols)Appends a newXWPFTableto this footnoteabstract voidensureFootnoteRef(XWPFParagraph p)Ensure that the specified paragraph has a reference marker for this footnote by adding a footnote reference if one is not found.java.util.List<IBodyElement>getBodyElements()Gets the body elements (IBodyElement) of the footnote.CTFtnEdngetCTFtnEdn()Gets the underlying CTFtnEdn object for the footnote.java.math.BigIntegergetId()Get the ID of the footnote.POIXMLDocumentPartgetOwner()The owning object for this footnoteXWPFParagraphgetParagraph(CTP p)Returns the paragraph corresponding to the providedCTP.XWPFParagraphgetParagraphArray(int pos)Returns theXWPFParagraphat position pos in footnote's paragraph array.java.util.List<XWPFParagraph>getParagraphs()Get the list ofXWPFParagraphs in the footnote.POIXMLDocumentPartgetPart()Get the Part to which the footnote belongs, which you need for adding relationships to other partsBodyTypegetPartType()Get the part typeBodyTypeof the footnote.java.util.List<XWPFPictureData>getPictures()Gets the list ofXWPFPictureDatas in the footnote.XWPFTablegetTable(CTTbl ctTable)XWPFTablegetTableArray(int pos)Gets theXWPFTableat the specified position from the footnote's table array.XWPFTableCellgetTableCell(CTTc cell)get theXWPFTableCellthat belongs to the CTTc cell.java.util.List<XWPFTable>getTables()Get the list ofXWPFTables in the footnote.XWPFDocumentgetXWPFDocument()Get theXWPFDocumentthe footnote is part of.XWPFParagraphinsertNewParagraph(XmlCursor cursor)Add a newXWPFParagraphat position of the cursor.XWPFTableinsertNewTbl(XmlCursor cursor)Insert a table constructed from OOXML table markup.voidinsertTable(int pos, XWPFTable table)Inserts an existing XWPFTable into the arrays bodyElements and tables.java.util.Iterator<XWPFParagraph>iterator()Get an iterator over theXWPFParagraphs in the footnote.voidsetCTFtnEdn(CTFtnEdn footnote)Set the underlying CTFtnEdn for the footnote.java.util.Spliterator<XWPFParagraph>spliterator()Get a spliterator over theXWPFParagraphs in the footnote.
-
-
-
Method Detail
-
getParagraphs
public java.util.List<XWPFParagraph> getParagraphs()
Get the list ofXWPFParagraphs in the footnote.- Specified by:
getParagraphsin interfaceIBody- Returns:
- List of paragraphs
-
iterator
public java.util.Iterator<XWPFParagraph> iterator()
Get an iterator over theXWPFParagraphs in the footnote.- Specified by:
iteratorin interfacejava.lang.Iterable<XWPFParagraph>- Returns:
- Iterator over the paragraph list.
-
spliterator
public java.util.Spliterator<XWPFParagraph> spliterator()
Get a spliterator over theXWPFParagraphs in the footnote.- Specified by:
spliteratorin interfacejava.lang.Iterable<XWPFParagraph>- Returns:
- Spliterator over the paragraph list.
- Since:
- POI 5.2.0
-
getPictures
public java.util.List<XWPFPictureData> getPictures()
Gets the list ofXWPFPictureDatas in the footnote.- Returns:
- List of pictures
-
getBodyElements
public java.util.List<IBodyElement> getBodyElements()
Gets the body elements (IBodyElement) of the footnote.- Specified by:
getBodyElementsin interfaceIBody- Returns:
- List of body elements.
-
getCTFtnEdn
public CTFtnEdn getCTFtnEdn()
Gets the underlying CTFtnEdn object for the footnote.- Returns:
- CTFtnEdn object
-
setCTFtnEdn
public void setCTFtnEdn(CTFtnEdn footnote)
Set the underlying CTFtnEdn for the footnote.Use
XWPFDocument.createFootnote()to create new footnotes.- Parameters:
footnote- The CTFtnEdn object that will underly the footnote.
-
getTableArray
public XWPFTable getTableArray(int pos)
Gets theXWPFTableat the specified position from the footnote's table array.- Specified by:
getTableArrayin interfaceIBody- Parameters:
pos- in table array- Returns:
- The
XWPFTableat position pos, or null if there is no table at position pos.
-
insertTable
public void insertTable(int pos, XWPFTable table)Inserts an existing XWPFTable into the arrays bodyElements and tables.- Specified by:
insertTablein interfaceIBody- Parameters:
pos- Position, in the bodyElements array, to insert the tabletable- XWPFTable to be inserted
-
getParagraph
public XWPFParagraph getParagraph(CTP p)
Description copied from interface:IBodyReturns the paragraph corresponding to the providedCTP.- Specified by:
getParagraphin interfaceIBody- 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.
-
getParagraphArray
public XWPFParagraph getParagraphArray(int pos)
Returns theXWPFParagraphat position pos in footnote's paragraph array.- Specified by:
getParagraphArrayin interfaceIBody- Parameters:
pos- Array position of the paragraph to get.- Returns:
- the
XWPFParagraphat position pos, or null if there is no paragraph at that position.
-
getTableCell
public XWPFTableCell getTableCell(CTTc cell)
get theXWPFTableCellthat belongs to the CTTc cell.- Specified by:
getTableCellin interfaceIBody- Returns:
XWPFTableCellthat corresponds to the CTTc cell, if there is one, otherwise null.
-
getOwner
public POIXMLDocumentPart getOwner()
The owning object for this footnote- Returns:
- The
XWPFFootnotesobject that contains this footnote.
-
insertNewTbl
public XWPFTable insertNewTbl(XmlCursor cursor)
Insert a table constructed from OOXML table markup.- Specified by:
insertNewTblin interfaceIBody- Returns:
- the inserted
XWPFTable
-
insertNewParagraph
public XWPFParagraph insertNewParagraph(XmlCursor cursor)
Add a newXWPFParagraphat position of the cursor.- Specified by:
insertNewParagraphin interfaceIBody- Returns:
- The inserted
XWPFParagraph
-
addNewParagraph
public XWPFParagraph addNewParagraph(CTP paragraph)
Add a newXWPFParagraphto the end of the footnote.- Parameters:
paragraph- CTP paragraph from which to construct theXWPFParagraph- Returns:
- The added
XWPFParagraph
-
getXWPFDocument
public XWPFDocument getXWPFDocument()
Get theXWPFDocumentthe footnote is part of.- Specified by:
getXWPFDocumentin interfaceIBody
-
getPart
public POIXMLDocumentPart getPart()
Get the Part to which the footnote belongs, which you need for adding relationships to other parts- Specified by:
getPartin interfaceIBody- Returns:
POIXMLDocumentPartthat contains the footnote.
-
getPartType
public BodyType getPartType()
Get the part typeBodyTypeof the footnote.- Specified by:
getPartTypein interfaceIBody- Returns:
- The
BodyTypevalue.
-
getId
public java.math.BigInteger getId()
Get the ID of the footnote.Footnote IDs are unique across all bottom-of-the-page and end note footnotes.
- Returns:
- Footnote ID
- Since:
- 4.0.0
-
createParagraph
public XWPFParagraph createParagraph()
Appends a newXWPFParagraphto this footnote.- Returns:
- The new
XWPFParagraph - Since:
- 4.0.0
-
ensureFootnoteRef
public abstract void ensureFootnoteRef(XWPFParagraph p)
Ensure that the specified paragraph has a reference marker for this footnote by adding a footnote reference if one is not found.This method is for the first paragraph in the footnote, not paragraphs that will refer to the footnote. For references to the footnote, use
XWPFParagraph.addFootnoteReference(XWPFAbstractFootnoteEndnote).The first run of the first paragraph in a footnote should contain a
CTFtnEdnRefobject.- Parameters:
p- TheXWPFParagraphto ensure- Since:
- 4.0.0
-
createTable
public XWPFTable createTable()
Appends a newXWPFTableto this footnote- Returns:
- The new
XWPFTable - Since:
- 4.0.0
-
createTable
public XWPFTable createTable(int rows, int cols)
Appends a newXWPFTableto this footnote- Parameters:
rows- Number of rows to initialize the table withcols- Number of columns to initialize the table with- Returns:
- the new
XWPFTablewith the specified number of rows and columns - Since:
- 4.0.0
-
-