Search in sources :

Example 1 with PageType

use of com.microsoft.schemas.office.visio.x2012.main.PageType in project poi by apache.

the class XDGFPages method onDocumentRead.

@Override
protected void onDocumentRead() {
    try {
        try {
            _pagesObject = PagesDocument.Factory.parse(getPackagePart().getInputStream()).getPages();
        } catch (XmlException e) {
            throw new POIXMLException(e);
        } catch (IOException e) {
            throw new POIXMLException(e);
        }
        // this iteration is ordered by page number
        for (PageType pageSettings : _pagesObject.getPageArray()) {
            String relId = pageSettings.getRel().getId();
            POIXMLDocumentPart pageContentsPart = getRelationById(relId);
            if (pageContentsPart == null)
                throw new POIXMLException("PageSettings relationship for " + relId + " not found");
            if (!(pageContentsPart instanceof XDGFPageContents))
                throw new POIXMLException("Unexpected pages relationship for " + relId + ": " + pageContentsPart);
            XDGFPageContents contents = (XDGFPageContents) pageContentsPart;
            XDGFPage page = new XDGFPage(pageSettings, contents, _document, this);
            contents.onDocumentRead();
            _pages.add(page);
        }
    } catch (POIXMLException e) {
        throw XDGFException.wrap(this, e);
    }
}
Also used : XmlException(org.apache.xmlbeans.XmlException) POIXMLDocumentPart(org.apache.poi.POIXMLDocumentPart) POIXMLException(org.apache.poi.POIXMLException) IOException(java.io.IOException) PageType(com.microsoft.schemas.office.visio.x2012.main.PageType)

Aggregations

PageType (com.microsoft.schemas.office.visio.x2012.main.PageType)1 IOException (java.io.IOException)1 POIXMLDocumentPart (org.apache.poi.POIXMLDocumentPart)1 POIXMLException (org.apache.poi.POIXMLException)1 XmlException (org.apache.xmlbeans.XmlException)1