Search in sources :

Example 6 with XmlOptions

use of org.apache.xmlbeans.XmlOptions in project poi by apache.

the class XSLFTheme method commit.

protected final void commit() throws IOException {
    XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
    xmlOptions.setSaveSyntheticDocumentElement(new QName("http://schemas.openxmlformats.org/drawingml/2006/main", "theme"));
    PackagePart part = getPackagePart();
    OutputStream out = part.getOutputStream();
    getXmlObject().save(out, xmlOptions);
    out.close();
}
Also used : QName(javax.xml.namespace.QName) XmlOptions(org.apache.xmlbeans.XmlOptions) OutputStream(java.io.OutputStream) PackagePart(org.apache.poi.openxml4j.opc.PackagePart)

Example 7 with XmlOptions

use of org.apache.xmlbeans.XmlOptions in project poi by apache.

the class XSSFPivotCacheDefinition method commit.

@Beta
@Override
protected void commit() throws IOException {
    PackagePart part = getPackagePart();
    OutputStream out = part.getOutputStream();
    XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
    //Sets the pivotCacheDefinition tag
    xmlOptions.setSaveSyntheticDocumentElement(new QName(CTPivotCacheDefinition.type.getName().getNamespaceURI(), "pivotCacheDefinition"));
    ctPivotCacheDefinition.save(out, xmlOptions);
    out.close();
}
Also used : QName(javax.xml.namespace.QName) OutputStream(java.io.OutputStream) XmlOptions(org.apache.xmlbeans.XmlOptions) PackagePart(org.apache.poi.openxml4j.opc.PackagePart) Beta(org.apache.poi.util.Beta)

Example 8 with XmlOptions

use of org.apache.xmlbeans.XmlOptions in project poi by apache.

the class XSSFPivotTable method commit.

@Beta
@Override
protected void commit() throws IOException {
    XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
    //Sets the pivotTableDefinition tag
    xmlOptions.setSaveSyntheticDocumentElement(new QName(CTPivotTableDefinition.type.getName().getNamespaceURI(), "pivotTableDefinition"));
    PackagePart part = getPackagePart();
    OutputStream out = part.getOutputStream();
    pivotTableDefinition.save(out, xmlOptions);
    out.close();
}
Also used : QName(javax.xml.namespace.QName) XmlOptions(org.apache.xmlbeans.XmlOptions) OutputStream(java.io.OutputStream) PackagePart(org.apache.poi.openxml4j.opc.PackagePart) Beta(org.apache.poi.util.Beta)

Example 9 with XmlOptions

use of org.apache.xmlbeans.XmlOptions in project poi by apache.

the class XSSFPivotCache method readFrom.

@Beta
protected void readFrom(InputStream is) throws IOException {
    try {
        XmlOptions options = new XmlOptions(DEFAULT_XML_OPTIONS);
        //Removing root element
        options.setLoadReplaceDocumentElement(null);
        ctPivotCache = CTPivotCache.Factory.parse(is, options);
    } catch (XmlException e) {
        throw new IOException(e.getLocalizedMessage());
    }
}
Also used : XmlException(org.apache.xmlbeans.XmlException) XmlOptions(org.apache.xmlbeans.XmlOptions) IOException(java.io.IOException) Beta(org.apache.poi.util.Beta)

Example 10 with XmlOptions

use of org.apache.xmlbeans.XmlOptions in project poi by apache.

the class XWPFDocument method commit.

/**
     * commit and saves the document
     */
@Override
protected void commit() throws IOException {
    XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
    xmlOptions.setSaveSyntheticDocumentElement(new QName(CTDocument1.type.getName().getNamespaceURI(), "document"));
    PackagePart part = getPackagePart();
    OutputStream out = part.getOutputStream();
    ctDocument.save(out, xmlOptions);
    out.close();
}
Also used : QName(javax.xml.namespace.QName) XmlOptions(org.apache.xmlbeans.XmlOptions) ByteArrayOutputStream(java.io.ByteArrayOutputStream) OutputStream(java.io.OutputStream) PackagePart(org.apache.poi.openxml4j.opc.PackagePart)

Aggregations

XmlOptions (org.apache.xmlbeans.XmlOptions)29 OutputStream (java.io.OutputStream)18 QName (javax.xml.namespace.QName)18 PackagePart (org.apache.poi.openxml4j.opc.PackagePart)17 XmlException (org.apache.xmlbeans.XmlException)8 IOException (java.io.IOException)7 Beta (org.apache.poi.util.Beta)7 ByteArrayOutputStream (java.io.ByteArrayOutputStream)5 HashMap (java.util.HashMap)2 MarshalException (javax.xml.crypto.MarshalException)2 EncryptedDocumentException (org.apache.poi.EncryptedDocumentException)2 XmlCursor (org.apache.xmlbeans.XmlCursor)2 XmlObject (org.apache.xmlbeans.XmlObject)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 File (java.io.File)1 FileOutputStream (java.io.FileOutputStream)1 InputStream (java.io.InputStream)1 GeneralSecurityException (java.security.GeneralSecurityException)1 InvalidAlgorithmParameterException (java.security.InvalidAlgorithmParameterException)1 Map (java.util.Map)1