Search in sources :

Example 1 with FootnotesDocument

use of org.openxmlformats.schemas.wordprocessingml.x2006.main.FootnotesDocument 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));
    }
}
Also used : CTFtnEdn(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn) InputStream(java.io.InputStream) XmlException(org.apache.xmlbeans.XmlException) FootnotesDocument(org.openxmlformats.schemas.wordprocessingml.x2006.main.FootnotesDocument) POIXMLException(org.apache.poi.POIXMLException)

Aggregations

InputStream (java.io.InputStream)1 POIXMLException (org.apache.poi.POIXMLException)1 XmlException (org.apache.xmlbeans.XmlException)1 CTFtnEdn (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFtnEdn)1 FootnotesDocument (org.openxmlformats.schemas.wordprocessingml.x2006.main.FootnotesDocument)1