Search in sources :

Example 11 with CTGroupShape

use of org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape in project poi by apache.

the class XSLFMetroShape method parseShape.

/*
     * parses the metro bytes to a XSLF shape
     */
public static Shape<?, ?> parseShape(byte[] metroBytes) throws InvalidFormatException, IOException, XmlException {
    PackagePartName shapePN = PackagingURIHelper.createPartName("/drs/shapexml.xml");
    OPCPackage pkg = null;
    try {
        pkg = OPCPackage.open(new ByteArrayInputStream(metroBytes));
        PackagePart shapePart = pkg.getPart(shapePN);
        CTGroupShape gs = CTGroupShape.Factory.parse(shapePart.getInputStream(), DEFAULT_XML_OPTIONS);
        XSLFGroupShape xgs = new XSLFGroupShape(gs, null);
        return xgs.getShapes().get(0);
    } finally {
        if (pkg != null) {
            pkg.close();
        }
    }
}
Also used : PackagePartName(org.apache.poi.openxml4j.opc.PackagePartName) ByteArrayInputStream(java.io.ByteArrayInputStream) PackagePart(org.apache.poi.openxml4j.opc.PackagePart) OPCPackage(org.apache.poi.openxml4j.opc.OPCPackage) CTGroupShape(org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape)

Aggregations

CTGroupShape (org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape)10 XmlObject (org.apache.xmlbeans.XmlObject)6 CTGraphicalObjectFrame (org.openxmlformats.schemas.presentationml.x2006.main.CTGraphicalObjectFrame)5 CTShape (org.openxmlformats.schemas.presentationml.x2006.main.CTShape)5 CTConnector (org.openxmlformats.schemas.presentationml.x2006.main.CTConnector)4 CTPicture (org.openxmlformats.schemas.presentationml.x2006.main.CTPicture)4 ArrayList (java.util.ArrayList)2 XmlException (org.apache.xmlbeans.XmlException)2 CTNonVisualDrawingProps (org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps)2 CTGroupShapeNonVisual (org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShapeNonVisual)2 Rectangle2D (java.awt.geom.Rectangle2D)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 POIXMLException (org.apache.poi.POIXMLException)1 OPCPackage (org.apache.poi.openxml4j.opc.OPCPackage)1 PackagePart (org.apache.poi.openxml4j.opc.PackagePart)1 PackagePartName (org.apache.poi.openxml4j.opc.PackagePartName)1 XmlCursor (org.apache.xmlbeans.XmlCursor)1 XmlAnyTypeImpl (org.apache.xmlbeans.impl.values.XmlAnyTypeImpl)1 CTGraphicalObjectData (org.openxmlformats.schemas.drawingml.x2006.main.CTGraphicalObjectData)1 CTGroupShapeProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTGroupShapeProperties)1