Package org.apache.poi.xwpf.usermodel
Class XWPFEndnotes
java.lang.Object
org.apache.poi.ooxml.POIXMLDocumentPart
org.apache.poi.xwpf.usermodel.XWPFAbstractFootnotesEndnotes
org.apache.poi.xwpf.usermodel.XWPFEndnotes
Looks after the collection of end notes for a document.
Managed end notes (
XWPFEndnote).- Since:
- 4.0.0
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.poi.ooxml.POIXMLDocumentPart
POIXMLDocumentPart.RelationPart -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.openxmlformats.schemas.wordprocessingml.x2006.main.CTEndnotesFields inherited from class org.apache.poi.xwpf.usermodel.XWPFAbstractFootnotesEndnotes
document, listFootnote -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEndnote(XWPFEndnote endnote) add anXWPFEndnoteto the documentaddEndnote(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn note) Add an endnote to the documentprotected voidcommit()Save the content in the underlying package part.Create a new end note and add it to the document.Get the list ofXWPFEndnotein the Endnotes part.getFootnoteById(int id) Get the end note with the specified ID, if any.protected voidRead documentbooleanremoveEndnote(int pos) Remove the specified end note if present.booleanremoveFootnote(int pos) Remove the specified footnote if present.voidsetEndnotes(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTEndnotes endnotes) Set the end notes for this part.Methods inherited from class org.apache.poi.xwpf.usermodel.XWPFAbstractFootnotesEndnotes
getIdManager, getXWPFDocument, setIdManager, setXWPFDocumentMethods inherited from class org.apache.poi.ooxml.POIXMLDocumentPart
_invokeOnDocumentRead, addRelation, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, getTargetPart, isCommited, onDocumentCreate, onDocumentRemove, onSave, prepareForCommit, read, rebase, removeRelation, removeRelation, removeRelation, setCommited, toString
-
Field Details
-
ctEndnotes
protected org.openxmlformats.schemas.wordprocessingml.x2006.main.CTEndnotes ctEndnotes
-
-
Constructor Details
-
XWPFEndnotes
public XWPFEndnotes() -
XWPFEndnotes
Construct XWPFEndnotes from a package part- Parameters:
part- the package part holding the data of the footnotes,- Throws:
IOExceptionOpenXML4JException- Since:
- POI 3.14-Beta1
-
-
Method Details
-
setEndnotes
@Internal public void setEndnotes(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTEndnotes endnotes) Set the end notes for this part.- Parameters:
endnotes- The endnotes to be added.
-
createEndnote
Create a new end note and add it to the document.- Returns:
- New XWPFEndnote
- Since:
- 4.0.0
-
removeFootnote
public boolean removeFootnote(int pos) Remove the specified footnote if present.- Parameters:
pos-- Returns:
- True if the footnote was removed.
- Since:
- 4.0.0
-
onDocumentRead
Read document- Overrides:
onDocumentReadin classPOIXMLDocumentPart- Throws:
IOException- a subclass may throw an IOException when a document is read
-
commit
Description 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(); OutputStream out = part.getOutputStream(); XmlObject bean = getXmlBean(); //the "model" which holds changes in memory bean.save(out, DEFAULT_XML_OPTIONS); out.close(); }- Overrides:
commitin classPOIXMLDocumentPart- Throws:
IOException- a subclass may throw an IOException if the changes can't be committed
-
addEndnote
add anXWPFEndnoteto the document- Parameters:
endnote-- Throws:
IOException
-
addEndnote
@Internal public XWPFEndnote addEndnote(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn note) Add an endnote to the document- Parameters:
note- Note to add- Returns:
- New
XWPFEndnote - Throws:
IOException
-
getFootnoteById
Get the end note with the specified ID, if any.- Overrides:
getFootnoteByIdin classXWPFAbstractFootnotesEndnotes- Parameters:
id- End note ID.- Returns:
- The end note or null if not found.
-
getEndnotesList
Get the list ofXWPFEndnotein the Endnotes part.- Returns:
- List, possibly empty, of end notes.
-
removeEndnote
public boolean removeEndnote(int pos) Remove the specified end note if present.- Parameters:
pos- Array position of the endnote to be removed- Returns:
- True if the end note was removed.
- Since:
- 4.0.0
-