Package org.apache.poi.xwpf.usermodel
Class XWPFFootnotes
- java.lang.Object
-
- org.apache.poi.ooxml.POIXMLDocumentPart
-
- org.apache.poi.xwpf.usermodel.XWPFAbstractFootnotesEndnotes
-
- org.apache.poi.xwpf.usermodel.XWPFFootnotes
-
public class XWPFFootnotes extends XWPFAbstractFootnotesEndnotes
Looks after the collection of Footnotes for a document. Manages bottom-of-the-page footnotes (XWPFFootnote).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.poi.ooxml.POIXMLDocumentPart
POIXMLDocumentPart.RelationPart
-
-
Field Summary
Fields Modifier and Type Field Description protected org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFootnotesctFootnotes-
Fields inherited from class org.apache.poi.xwpf.usermodel.XWPFAbstractFootnotesEndnotes
document, listFootnote
-
-
Constructor Summary
Constructors Constructor Description XWPFFootnotes()Construct XWPFFootnotes from scratch for a new document.XWPFFootnotes(PackagePart part)Construct XWPFFootnotes from a package part
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFootnote(XWPFFootnote footnote)Add anXWPFFootnoteto the documentXWPFFootnoteaddFootnote(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn note)Add a CT footnote to the documentprotected voidcommit()Save the content in the underlying package part.XWPFFootnotecreateFootnote()Create a new footnote and add it to the document.List<XWPFFootnote>getFootnotesList()Get the list ofXWPFFootnotein the Footnotes part.protected voidonDocumentRead()Read documentbooleanremoveFootnote(int pos)Remove the specified footnote if present.voidsetFootnotes(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFootnotes footnotes)Sets the ctFootnotes-
Methods inherited from class org.apache.poi.xwpf.usermodel.XWPFAbstractFootnotesEndnotes
getFootnoteById, getIdManager, getXWPFDocument, setIdManager, setXWPFDocument
-
Methods inherited from class org.apache.poi.ooxml.POIXMLDocumentPart
_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, getTargetPart, isCommitted, onDocumentCreate, onDocumentRemove, onSave, prepareForCommit, read, rebase, removeRelation, removeRelation, removeRelation, setCommitted, toString
-
-
-
-
Constructor Detail
-
XWPFFootnotes
public XWPFFootnotes(PackagePart part)
Construct XWPFFootnotes from a package part- Parameters:
part- the package part holding the data of the footnotes,- Since:
- POI 3.14-Beta1
-
XWPFFootnotes
public XWPFFootnotes()
Construct XWPFFootnotes from scratch for a new document.
-
-
Method Detail
-
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 IOExceptionRead document- Overrides:
onDocumentReadin classPOIXMLDocumentPart- Throws:
IOException- a subclass may throw an IOException when a document is read
-
commit
protected void commit() throws IOExceptionDescription copied from class:POIXMLDocumentPartSave 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(); try (OutputStream out = part.getOutputStream()) { XmlObject bean = getXmlBean(); //the "model" which holds changes in memory bean.save(out, DEFAULT_XML_OPTIONS); } }- Overrides:
commitin classPOIXMLDocumentPart- Throws:
IOException- a subclass may throw an IOException if the changes can't be committed
-
addFootnote
public void addFootnote(XWPFFootnote footnote)
Add anXWPFFootnoteto the document- Parameters:
footnote- Footnote to add
-
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.
-
getFootnotesList
public List<XWPFFootnote> getFootnotesList()
Get the list ofXWPFFootnotein the Footnotes part.- Returns:
- List, possibly empty, of footnotes.
-
-