Class XWPFFootnotes


public class XWPFFootnotes extends XWPFAbstractFootnotesEndnotes
Looks after the collection of Footnotes for a document. Manages bottom-of-the-page footnotes (XWPFFootnote).
  • Field Details

    • ctFootnotes

      protected org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFootnotes ctFootnotes
  • Constructor Details

    • XWPFFootnotes

      public XWPFFootnotes(PackagePart part) throws IOException, OpenXML4JException
      Construct XWPFFootnotes from a package part
      Parameters:
      part - the package part holding the data of the footnotes,
      Throws:
      IOException
      OpenXML4JException
      Since:
      POI 3.14-Beta1
    • XWPFFootnotes

      public XWPFFootnotes()
      Construct XWPFFootnotes from scratch for a new document.
  • Method Details

    • setFootnotes

      @Internal public void setFootnotes(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFootnotes footnotes)
      Sets the ctFootnotes
      Parameters:
      footnotes - Collection of CTFntEdn objects.
    • createFootnote

      public XWPFFootnote createFootnote()
      Create a new footnote and add it to the document.
      Returns:
      New XWPFFootnote
      Since:
      4.0.0
    • removeFootnote

      public boolean removeFootnote(int pos)
      Remove the specified footnote if present.
      Parameters:
      pos - Array position of the footnote to be removed
      Returns:
      True if the footnote was removed.
      Since:
      4.0.0
    • onDocumentRead

      protected void onDocumentRead() throws IOException
      Read document
      Overrides:
      onDocumentRead in class POIXMLDocumentPart
      Throws:
      IOException - a subclass may throw an IOException when a document is read
    • commit

      protected void commit() throws IOException
      Description copied from class: POIXMLDocumentPart
      Save the content in the underlying package part. Default implementation is empty meaning that the package part is left unmodified.

      Sub-classes should override and add logic to marshal the "model" into Ooxml4J.

      For example, the code saving a generic XML entry may look as follows:

       protected void commit() throws IOException {
         PackagePart part = getPackagePart();
         OutputStream out = part.getOutputStream();
         XmlObject bean = getXmlBean(); //the "model" which holds changes in memory
         bean.save(out, DEFAULT_XML_OPTIONS);
         out.close();
       }
       
      Overrides:
      commit in class POIXMLDocumentPart
      Throws:
      IOException - a subclass may throw an IOException if the changes can't be committed
    • addFootnote

      public void addFootnote(XWPFFootnote footnote)
      Add an XWPFFootnote to the document
      Parameters:
      footnote - Footnote to add
      Throws:
      IOException
    • addFootnote

      @Internal public XWPFFootnote addFootnote(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn note)
      Add a CT footnote to the document
      Parameters:
      note - CTFtnEdn to add.
      Throws:
      IOException
    • getFootnotesList

      public List<XWPFFootnote> getFootnotesList()
      Get the list of XWPFFootnote in the Footnotes part.
      Returns:
      List, possibly empty, of footnotes.