Package org.apache.poi.xwpf.usermodel
Class XWPFAbstractFootnoteEndnote
java.lang.Object
org.apache.poi.xwpf.usermodel.XWPFAbstractFootnoteEndnote
- All Implemented Interfaces:
Iterable<XWPFParagraph>
,IBody
- Direct Known Subclasses:
XWPFEndnote
,XWPFFootnote
public abstract class XWPFAbstractFootnoteEndnote
extends Object
implements Iterable<XWPFParagraph>, IBody
Base class for both bottom-of-the-page footnotes
XWPFFootnote
and end
notes XWPFEndnote
).
The only significant difference between footnotes and
end notes is which part they go on. Footnotes are managed by the Footnotes part
XWPFFootnotes
and end notes are managed by the Endnotes part XWPFEndnotes
.
- Since:
- 4.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn
protected XWPFDocument
protected XWPFAbstractFootnotesEndnotes
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
XWPFAbstractFootnoteEndnote
(XWPFDocument document, org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn body) protected
XWPFAbstractFootnoteEndnote
(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn note, XWPFAbstractFootnotesEndnotes footnotes) -
Method Summary
Modifier and TypeMethodDescriptionaddNewParagraph
(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP paragraph) Add a newXWPFParagraph
to the end of the footnote.addNewTbl
(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl table) Add a newXWPFTable
to the end of the footnote.Appends a newXWPFParagraph
to this footnote.Appends a newXWPFTable
to this footnotecreateTable
(int rows, int cols) Appends a newXWPFTable
to this footnoteabstract void
Ensure that the specified paragraph has a reference marker for this footnote by adding a footnote reference if one is not found.Gets the body elements (IBodyElement
) of the footnote.org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn
Gets the underlying CTFtnEdn object for the footnote.getId()
Get the ID of the footnote.getOwner()
The owning object for this footnotegetParagraph
(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP p) if there is a correspondingXWPFParagraph
of the parameter p in the paragraphList of this header or footer the method will return that paragraph, otherwise the method will return null.getParagraphArray
(int pos) Returns theXWPFParagraph
at position pos in footnote's paragraph array.Get the list ofXWPFParagraph
s in the footnote.getPart()
Get the Part to which the footnote belongs, which you need for adding relationships to other partsGet the part typeBodyType
of the footnote.Gets the list ofXWPFPictureData
s in the footnote.getTable
(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl ctTable) getTableArray
(int pos) Gets theXWPFTable
at the specified position from the footnote's table array.getTableCell
(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc cell) get theXWPFTableCell
that belongs to the CTTc cell.Get the list ofXWPFTable
s in the footnote.Get theXWPFDocument
the footnote is part of.protected void
init()
insertNewParagraph
(org.apache.xmlbeans.XmlCursor cursor) Add a newXWPFParagraph
at position of the cursor.insertNewTbl
(org.apache.xmlbeans.XmlCursor cursor) Insert a table constructed from OOXML table markup.void
insertTable
(int pos, XWPFTable table) Inserts an existinginvalid @link
{@link XWPFTable) into the arrays bodyElements and tables.
iterator()
Get an iterator over theXWPFParagraph
s in the footnote.void
setCTFtnEdn
(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn footnote) Set the underlying CTFtnEdn for the footnote.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
ctFtnEdn
protected org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn ctFtnEdn -
footnotes
-
document
-
-
Constructor Details
-
XWPFAbstractFootnoteEndnote
public XWPFAbstractFootnoteEndnote() -
XWPFAbstractFootnoteEndnote
@Internal protected XWPFAbstractFootnoteEndnote(XWPFDocument document, org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn body) -
XWPFAbstractFootnoteEndnote
@Internal protected XWPFAbstractFootnoteEndnote(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn note, XWPFAbstractFootnotesEndnotes footnotes)
-
-
Method Details
-
init
protected void init() -
getParagraphs
Get the list ofXWPFParagraph
s in the footnote.- Specified by:
getParagraphs
in interfaceIBody
- Returns:
- List of paragraphs
-
iterator
Get an iterator over theXWPFParagraph
s in the footnote.- Specified by:
iterator
in interfaceIterable<XWPFParagraph>
- Returns:
- Iterator over the paragraph list.
-
getTables
Get the list ofXWPFTable
s in the footnote. -
getPictures
Gets the list ofXWPFPictureData
s in the footnote.- Returns:
- List of pictures
-
getBodyElements
Gets the body elements (IBodyElement
) of the footnote.- Specified by:
getBodyElements
in interfaceIBody
- Returns:
- List of body elements.
-
getCTFtnEdn
public org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn getCTFtnEdn()Gets the underlying CTFtnEdn object for the footnote.- Returns:
- CTFtnEdn object
-
setCTFtnEdn
public void setCTFtnEdn(org.openxmlformats.schemas.wordprocessingml.x2006.main.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
Gets theXWPFTable
at the specified position from the footnote's table array.- Specified by:
getTableArray
in interfaceIBody
- Parameters:
pos
- in table array- Returns:
- The
XWPFTable
at position pos, or null if there is no table at position pos. - See Also:
-
insertTable
Inserts an existinginvalid @link
{@link XWPFTable) into the arrays bodyElements and tables.
- Specified by:
insertTable
in interfaceIBody
- Parameters:
pos
- Position, in the bodyElements array, to insert the tabletable
-invalid @link
{@link XWPFTable) to be inserted
- See Also:
-
getTable
-
getParagraph
if there is a correspondingXWPFParagraph
of the parameter p in the paragraphList of this header or footer the method will return that paragraph, otherwise the method will return null.- Specified by:
getParagraph
in interfaceIBody
- Parameters:
p
- The CTP paragraph to find the correspondingXWPFParagraph
for.- Returns:
- The
XWPFParagraph
that corresponds to the CTP paragraph in the paragraph list of this footnote or null if no paragraph is found. - See Also:
-
getParagraphArray
Returns theXWPFParagraph
at position pos in footnote's paragraph array.- Specified by:
getParagraphArray
in interfaceIBody
- Parameters:
pos
- Array position of the paragraph to get.- Returns:
- the
XWPFParagraph
at position pos, or null if there is no paragraph at that position. - See Also:
-
getTableCell
get theXWPFTableCell
that belongs to the CTTc cell.- Specified by:
getTableCell
in interfaceIBody
- Parameters:
cell
-- Returns:
XWPFTableCell
that corresponds to the CTTc cell, if there is one, otherwise null.- See Also:
-
getOwner
The owning object for this footnote- Returns:
- The
XWPFFootnotes
object that contains this footnote.
-
insertNewTbl
Insert a table constructed from OOXML table markup.- Specified by:
insertNewTbl
in interfaceIBody
- Parameters:
cursor
-- Returns:
- the inserted
XWPFTable
- See Also:
-
insertNewParagraph
Add a newXWPFParagraph
at position of the cursor.- Specified by:
insertNewParagraph
in interfaceIBody
- Parameters:
cursor
-- Returns:
- The inserted
XWPFParagraph
- See Also:
-
addNewTbl
Add a newXWPFTable
to the end of the footnote. -
addNewParagraph
public XWPFParagraph addNewParagraph(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP paragraph) Add a newXWPFParagraph
to the end of the footnote.- Parameters:
paragraph
- CTP paragraph from which to construct theXWPFParagraph
- Returns:
- The added
XWPFParagraph
-
getXWPFDocument
Get theXWPFDocument
the footnote is part of.- Specified by:
getXWPFDocument
in interfaceIBody
- See Also:
-
getPart
Get the Part to which the footnote belongs, which you need for adding relationships to other parts- Specified by:
getPart
in interfaceIBody
- Returns:
POIXMLDocumentPart
that contains the footnote.- See Also:
-
getPartType
Get the part typeBodyType
of the footnote.- Specified by:
getPartType
in interfaceIBody
- Returns:
- The
BodyType
value. - See Also:
-
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
Appends a newXWPFParagraph
to this footnote.- Returns:
- The new
XWPFParagraph
- Since:
- 4.0.0
-
ensureFootnoteRef
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(XWPFFootnote)
.The first run of the first paragraph in a footnote should contain a
CTFtnEdnRef
object.- Parameters:
p
- TheXWPFParagraph
to ensure- Since:
- 4.0.0
-
createTable
Appends a newXWPFTable
to this footnote- Returns:
- The new
XWPFTable
- Since:
- 4.0.0
-
createTable
Appends a newXWPFTable
to this footnote- Parameters:
rows
- Number of rows to initialize the table withcols
- Number of columns to initialize the table with- Returns:
- the new
XWPFTable
with the specified number of rows and columns - Since:
- 4.0.0
-