Search in sources :

Example 1 with StylesDocument

use of org.openxmlformats.schemas.wordprocessingml.x2006.main.StylesDocument in project poi by apache.

the class XWPFStyles method onDocumentRead.

/**
     * Read document
     */
@Override
protected void onDocumentRead() throws IOException {
    StylesDocument stylesDoc;
    InputStream is = getPackagePart().getInputStream();
    try {
        stylesDoc = StylesDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);
        setStyles(stylesDoc.getStyles());
        latentStyles = new XWPFLatentStyles(ctStyles.getLatentStyles(), this);
    } catch (XmlException e) {
        throw new POIXMLException("Unable to read styles", e);
    } finally {
        is.close();
    }
}
Also used : StylesDocument(org.openxmlformats.schemas.wordprocessingml.x2006.main.StylesDocument) InputStream(java.io.InputStream) XmlException(org.apache.xmlbeans.XmlException) POIXMLException(org.apache.poi.POIXMLException)

Aggregations

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