Search in sources :

Example 1 with NumberingDocument

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

the class XWPFNumbering method onDocumentRead.

/**
     * read numbering form an existing package
     */
@Override
protected void onDocumentRead() throws IOException {
    NumberingDocument numberingDoc = null;
    InputStream is;
    is = getPackagePart().getInputStream();
    try {
        numberingDoc = NumberingDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);
        ctNumbering = numberingDoc.getNumbering();
        //get any Nums
        for (CTNum ctNum : ctNumbering.getNumArray()) {
            nums.add(new XWPFNum(ctNum, this));
        }
        for (CTAbstractNum ctAbstractNum : ctNumbering.getAbstractNumArray()) {
            abstractNums.add(new XWPFAbstractNum(ctAbstractNum, this));
        }
        isNew = false;
    } catch (XmlException e) {
        throw new POIXMLException();
    } finally {
        is.close();
    }
}
Also used : CTNum(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTNum) InputStream(java.io.InputStream) XmlException(org.apache.xmlbeans.XmlException) POIXMLException(org.apache.poi.POIXMLException) NumberingDocument(org.openxmlformats.schemas.wordprocessingml.x2006.main.NumberingDocument) CTAbstractNum(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTAbstractNum)

Aggregations

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