https://issues.apache.org/bugzilla/show_bug.cgi?id=55066
Bug ID: 55066
Summary: Then open XWPFDocument onDocumentRead method dublicate
existing Footnotes.
Product: POI
Version: 3.9
Hardware: PC
Status: NEW
Severity: critical
Priority: P2
Component: XWPF
Assignee: [email protected]
Reporter: [email protected]
Then open existing docx document as XWPFDocument, On onDocumentRead method
initFootnotes method dublicate existing Footnotes in document.
Here is a sample code with comments where there is a duplication:
private void initFootnotes() throws XmlException, IOException {
for(POIXMLDocumentPart p : getRelations()){
String relation = p.getPackageRelationship().getRelationshipType();
if (relation.equals(XWPFRelation.FOOTNOTE.getRelation())) {
FootnotesDocument footnotesDocument =
FootnotesDocument.Factory.parse(p.getPackagePart().getInputStream());
this.footnotes = (XWPFFootnotes)p;
this.footnotes.onDocumentRead(); // THERE ARE WE ALREADY HAVE
XWPFFootnotes WITH ALL DOCUMENT FOOTNOTES
for(CTFtnEdn ctFtnEdn :
footnotesDocument.getFootnotes().getFootnoteList()) {
footnotes.addFootnote(ctFtnEdn); // THERE ARE FOOTNOTES IS
DUBLICATING
}
} else if (relation.equals(XWPFRelation.ENDNOTE.getRelation())){
EndnotesDocument endnotesDocument =
EndnotesDocument.Factory.parse(p.getPackagePart().getInputStream());
for(CTFtnEdn ctFtnEdn :
endnotesDocument.getEndnotes().getEndnoteList()) {
endnotes.put(ctFtnEdn.getId().intValue(), new
XWPFFootnote(this, ctFtnEdn));
}
}
}
}
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]