use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn in project poi by apache.
the class TestXWPFFootnotes method testAddFootnotesToDocument.
public void testAddFootnotesToDocument() throws IOException {
XWPFDocument docOut = new XWPFDocument();
BigInteger noteId = BigInteger.valueOf(1);
XWPFFootnotes footnotes = docOut.createFootnotes();
CTFtnEdn ctNote = CTFtnEdn.Factory.newInstance();
ctNote.setId(noteId);
ctNote.setType(STFtnEdn.NORMAL);
footnotes.addFootnote(ctNote);
XWPFDocument docIn = XWPFTestDataSamples.writeOutAndReadBack(docOut);
XWPFFootnote note = docIn.getFootnoteByID(noteId.intValue());
assertEquals(note.getCTFtnEdn().getType(), STFtnEdn.NORMAL);
}
use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn in project poi by apache.
the class XWPFFootnotes method onDocumentRead.
/**
* Read document
*/
@Override
protected void onDocumentRead() throws IOException {
FootnotesDocument notesDoc;
InputStream is = null;
try {
is = getPackagePart().getInputStream();
notesDoc = FootnotesDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);
ctFootnotes = notesDoc.getFootnotes();
} catch (XmlException e) {
throw new POIXMLException();
} finally {
if (is != null) {
is.close();
}
}
// Find our footnotes
for (CTFtnEdn note : ctFootnotes.getFootnoteArray()) {
listFootnote.add(new XWPFFootnote(note, this));
}
}
use of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn in project poi by apache.
the class XWPFFootnotes method addFootnote.
/**
* add a footnote to the document
*
* @param note
* @throws IOException
*/
public XWPFFootnote addFootnote(CTFtnEdn note) {
CTFtnEdn newNote = ctFootnotes.addNewFootnote();
newNote.set(note);
XWPFFootnote xNote = new XWPFFootnote(newNote, this);
listFootnote.add(xNote);
return xNote;
}
Aggregations