Class 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 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
    • Constructor Detail

      • XWPFAbstractFootnoteEndnote

        public XWPFAbstractFootnoteEndnote()
    • Method Detail

      • iterator

        public java.util.Iterator<XWPFParagraph> iterator()
        Get an iterator over the XWPFParagraphs in the footnote.
        Specified by:
        iterator in interface java.lang.Iterable<XWPFParagraph>
        Returns:
        Iterator over the paragraph list.
      • getTables

        public java.util.List<XWPFTable> getTables()
        Get the list of XWPFTables in the footnote.
        Specified by:
        getTables in interface IBody
        Returns:
        List of tables
      • 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.
      • insertTable

        public void insertTable​(int pos,
                                XWPFTable table)
        Inserts an existing {@link XWPFTable) into the arrays bodyElements and tables.
        Specified by:
        insertTable in interface IBody
        Parameters:
        pos - Position, in the bodyElements array, to insert the table
        table - {@link XWPFTable) to be inserted
        See Also:
        IBody.insertTable(int pos, XWPFTable table)
      • getParagraph

        public XWPFParagraph getParagraph​(CTP p)
        if there is a corresponding XWPFParagraph 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 interface IBody
        Parameters:
        p - The CTP paragraph to find the corresponding XWPFParagraph 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:
        IBody.getParagraph(CTP p)
      • getOwner

        public org.apache.poi.ooxml.POIXMLDocumentPart getOwner()
        The owning object for this footnote
        Returns:
        The XWPFFootnotes object that contains this footnote.
      • addNewTbl

        public XWPFTable addNewTbl​(CTTbl table)
        Add a new XWPFTable to the end of the footnote.
        Parameters:
        table - CTTbl object from which to construct the XWPFTable
        Returns:
        The added XWPFTable
      • getPart

        public org.apache.poi.ooxml.POIXMLDocumentPart getPart()
        Get the Part to which the footnote belongs, which you need for adding relationships to other parts
        Specified by:
        getPart in interface IBody
        Returns:
        POIXMLDocumentPart that contains the footnote.
        See Also:
        IBody.getPart()
      • 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
      • 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(XWPFFootnote).

        The first run of the first paragraph in a footnote should contain a CTFtnEdnRef object.

        Parameters:
        p - The XWPFParagraph to ensure
        Since:
        4.0.0
      • createTable

        public XWPFTable createTable​(int rows,
                                     int cols)
        Appends a new XWPFTable to this footnote
        Parameters:
        rows - Number of rows to initialize the table with
        cols - Number of columns to initialize the table with
        Returns:
        the new XWPFTable with the specified number of rows and columns
        Since:
        4.0.0