org.apache.poi.xwpf.usermodel

## Class XWPFEndnote

- java.lang.Object
- - org.apache.poi.xwpf.usermodel.XWPFAbstractFootnoteEndnote
  - - org.apache.poi.xwpf.usermodel.XWPFEndnote

- All Implemented Interfaces:
    java.lang.Iterable<XWPFParagraph>, IBody

      public class XWPFEndnote
      extends XWPFAbstractFootnoteEndnote

  Represents an end note footnote.

  End notes are collected at the end of a document or section rather than at the bottom of a page.

  Create a new footnote using `XWPFDocument.createEndnote()` or `XWPFEndnotes#createFootnote()`.

  The first body element of a footnote should (or possibly must) be a paragraph with the first run containing a CTFtnEdnRef object. The `XWPFAbstractFootnoteEndnote.createParagraph()` and `XWPFAbstractFootnoteEndnote.createTable()` methods do this for you.

  Footnotes have IDs that are unique across all footnotes in the document. You use the footnote ID to create a reference to a footnote from within a paragraph.

  To create a reference to a footnote within a paragraph you create a run with a CTFtnEdnRef that specifies the ID of the target paragraph. The `XWPFParagraph.addFootnoteReference(XWPFAbstractFootnoteEndnote)` method does this for you.

  Since:
    4.0.0

- - ### Field Summary

    - ### Fields inherited from class org.apache.poi.xwpf.usermodel.XWPFAbstractFootnoteEndnote

      `ctFtnEdn, document, footnotes`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `XWPFEndnote()`
    `XWPFEndnote(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn note, XWPFAbstractFootnotesEndnotes footnotes)`
    `XWPFEndnote(XWPFDocument document, org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn body)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `ensureFootnoteRef(XWPFParagraph p)` Ensure that the specified paragraph has a reference marker for this end note by adding a footnote reference if one is not found.

    - ### Methods inherited from class org.apache.poi.xwpf.usermodel.XWPFAbstractFootnoteEndnote

      `addNewParagraph, addNewTbl, createParagraph, createTable, createTable, getBodyElements, getCTFtnEdn, getId, getOwner, getParagraph, getParagraphArray, getParagraphs, getPart, getPartType, getPictures, getTable, getTableArray, getTableCell, getTables, getXWPFDocument, init, insertNewParagraph, insertNewTbl, insertTable, iterator, setCTFtnEdn`

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

- - ### Constructor Detail

    - #### XWPFEndnote

          public XWPFEndnote()

    - #### XWPFEndnote

          @Internal
          public XWPFEndnote(XWPFDocument document,
                                       org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn body)

    - #### XWPFEndnote

          @Internal
          public XWPFEndnote(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn note,
                                       XWPFAbstractFootnotesEndnotes footnotes)

  - ### Method Detail

    - #### ensureFootnoteRef

          public void ensureFootnoteRef(XWPFParagraph p)

      Ensure that the specified paragraph has a reference marker for this end note 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 `CTFtnEdnRef` object.

      Specified by:
        `ensureFootnoteRef` in class `XWPFAbstractFootnoteEndnote`
      Parameters:
        `p` - The `XWPFParagraph` to ensure
      Since:
        4.0.0

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