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 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

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn` | `ctFtnEdn`
    `protected XWPFDocument` | `document`
    `protected XWPFAbstractFootnotesEndnotes` | `footnotes`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `` | `XWPFAbstractFootnoteEndnote()`
    `protected` | `XWPFAbstractFootnoteEndnote(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn note, XWPFAbstractFootnotesEndnotes footnotes)`
    `protected` | `XWPFAbstractFootnoteEndnote(XWPFDocument document, org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn body)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `XWPFParagraph` | `addNewParagraph(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP paragraph)` Add a new `XWPFParagraph` to the end of the footnote.
    `XWPFTable` | `addNewTbl(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl table)` Add a new `XWPFTable` to the end of the footnote.
    `XWPFParagraph` | `createParagraph()` Appends a new `XWPFParagraph` to this footnote.
    `XWPFTable` | `createTable()` Appends a new `XWPFTable` to this footnote
    `XWPFTable` | `createTable(int rows, int cols)` Appends a new `XWPFTable` to this footnote
    `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.
    `java.util.List<IBodyElement>` | `getBodyElements()` Gets the body elements (`IBodyElement`) of the footnote.
    `org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn` | `getCTFtnEdn()` Gets the underlying CTFtnEdn object for the footnote.
    `java.math.BigInteger` | `getId()` Get the ID of the footnote.
    `POIXMLDocumentPart` | `getOwner()` The owning object for this footnote
    `XWPFParagraph` | `getParagraph(org.openxmlformats.schemas.wordprocessingml.x2006.main.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.
    `XWPFParagraph` | `getParagraphArray(int pos)` Returns the `XWPFParagraph` at position pos in footnote's paragraph array.
    `java.util.List<XWPFParagraph>` | `getParagraphs()` Get the list of `XWPFParagraph`s in the footnote.
    `POIXMLDocumentPart` | `getPart()` Get the Part to which the footnote belongs, which you need for adding relationships to other parts
    `BodyType` | `getPartType()` Get the part type `BodyType` of the footnote.
    `java.util.List<XWPFPictureData>` | `getPictures()` Gets the list of `XWPFPictureData`s in the footnote.
    `XWPFTable` | `getTable(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl ctTable)` if there is a corresponding `XWPFTable` of the parameter ctTable in the tableList of this header the method will return this table, or null if there is no corresponding `XWPFTable`.
    `XWPFTable` | `getTableArray(int pos)` Gets the `XWPFTable` at the specified position from the footnote's table array.
    `XWPFTableCell` | `getTableCell(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc cell)` get the `XWPFTableCell` that belongs to the CTTc cell.
    `java.util.List<XWPFTable>` | `getTables()` Get the list of `XWPFTable`s in the footnote.
    `XWPFDocument` | `getXWPFDocument()` Get the `XWPFDocument` the footnote is part of.
    `protected void` | `init()`
    `XWPFParagraph` | `insertNewParagraph(org.apache.xmlbeans.XmlCursor cursor)` Add a new `XWPFParagraph` at position of the cursor.
    `XWPFTable` | `insertNewTbl(org.apache.xmlbeans.XmlCursor cursor)` Insert a table constructed from OOXML table markup.
    `void` | `insertTable(int pos, XWPFTable table)` Inserts an existing {@link XWPFTable) into the arrays bodyElements and tables.
    `java.util.Iterator<XWPFParagraph>` | `iterator()` Get an iterator over the `XWPFParagraph`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 Detail

    - #### ctFtnEdn

          protected org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn ctFtnEdn

    - #### footnotes

          protected XWPFAbstractFootnotesEndnotes footnotes

    - #### document

          protected XWPFDocument document

  - ### Constructor Detail

    - #### 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 Detail

    - #### init

          protected void init()

    - #### getParagraphs

          public java.util.List<XWPFParagraph> getParagraphs()

      Get the list of `XWPFParagraph`s in the footnote.
      Specified by:
        `getParagraphs` in interface `IBody`
      Returns:
        List of paragraphs

    - #### iterator

          public java.util.Iterator<XWPFParagraph> iterator()

      Get an iterator over the `XWPFParagraph`s 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 `XWPFTable`s in the footnote.
      Specified by:
        `getTables` in interface `IBody`
      Returns:
        List of tables

    - #### getPictures

          public java.util.List<XWPFPictureData> getPictures()

      Gets the list of `XWPFPictureData`s in the footnote.
      Returns:
        List of pictures

    - #### getBodyElements

          public java.util.List<IBodyElement> getBodyElements()

      Gets the body elements (`IBodyElement`) of the footnote.
      Specified by:
        `getBodyElements` in interface `IBody`
      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

          public XWPFTable getTableArray(int pos)

      Gets the `XWPFTable` at the specified position from the footnote's table array.
      Specified by:
        `getTableArray` in interface `IBody`
      Parameters:
        `pos` - in table array
      Returns:
        The `XWPFTable` at position pos, or null if there is no table at position pos.
      See Also:
        `IBody.getTableArray(int)`

    - #### 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)`

    - #### getTable

          public XWPFTable getTable(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl ctTable)

      if there is a corresponding `XWPFTable` of the parameter ctTable in the tableList of this header the method will return this table, or null if there is no corresponding `XWPFTable`.
      Specified by:
        `getTable` in interface `IBody`
      Parameters:
        `ctTable` -
      See Also:
        `IBody.getTable(CTTbl ctTable)`

    - #### getParagraph

          public XWPFParagraph getParagraph(org.openxmlformats.schemas.wordprocessingml.x2006.main.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)`

    - #### getParagraphArray

          public XWPFParagraph getParagraphArray(int pos)

      Returns the `XWPFParagraph` at position pos in footnote's paragraph array.
      Specified by:
        `getParagraphArray` in interface `IBody`
      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:
        `IBody.getParagraphArray(int pos)`

    - #### getTableCell

          public XWPFTableCell getTableCell(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc cell)

      get the `XWPFTableCell` that belongs to the CTTc cell.
      Specified by:
        `getTableCell` in interface `IBody`
      Parameters:
        `cell` -
      Returns:
        `XWPFTableCell` that corresponds to the CTTc cell, if there is one, otherwise null.
      See Also:
        `IBody.getTableCell(CTTc cell)`

    - #### getOwner

          public POIXMLDocumentPart getOwner()

      The owning object for this footnote
      Returns:
        The `XWPFFootnotes` object that contains this footnote.

    - #### insertNewTbl

          public XWPFTable insertNewTbl(org.apache.xmlbeans.XmlCursor cursor)

      Insert a table constructed from OOXML table markup.
      Specified by:
        `insertNewTbl` in interface `IBody`
      Parameters:
        `cursor` -
      Returns:
        the inserted `XWPFTable`
      See Also:
        `IBody.insertNewTbl(XmlCursor cursor)`

    - #### insertNewParagraph

          public XWPFParagraph insertNewParagraph(org.apache.xmlbeans.XmlCursor cursor)

      Add a new `XWPFParagraph` at position of the cursor.
      Specified by:
        `insertNewParagraph` in interface `IBody`
      Parameters:
        `cursor` -
      Returns:
        The inserted `XWPFParagraph`
      See Also:
        `IBody.insertNewParagraph(XmlCursor cursor)`

    - #### addNewTbl

          public XWPFTable addNewTbl(org.openxmlformats.schemas.wordprocessingml.x2006.main.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`

    - #### addNewParagraph

          public XWPFParagraph addNewParagraph(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTP paragraph)

      Add a new `XWPFParagraph` to the end of the footnote.
      Parameters:
        `paragraph` - CTP paragraph from which to construct the `XWPFParagraph`
      Returns:
        The added `XWPFParagraph`

    - #### getXWPFDocument

          public XWPFDocument getXWPFDocument()

      Get the `XWPFDocument` the footnote is part of.
      Specified by:
        `getXWPFDocument` in interface `IBody`
      See Also:
        `IBody.getXWPFDocument()`

    - #### getPart

          public 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()`

    - #### getPartType

          public BodyType getPartType()

      Get the part type `BodyType` of the footnote.
      Specified by:
        `getPartType` in interface `IBody`
      Returns:
        The `BodyType` value.
      See Also:
        `IBody.getPartType()`

    - #### 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 new `XWPFParagraph` to 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(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()

      Appends a new `XWPFTable` to this footnote
      Returns:
        The new `XWPFTable`
      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

Copyright 2020 The Apache Software Foundation or its licensors, as applicable.