Search in sources :

Example 21 with CTShapeProperties

use of org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties in project poi by apache.

the class XSSFObjectData method prototype.

/**
     * Prototype with the default structure of a new auto-shape.
     */
/**
     * Prototype with the default structure of a new auto-shape.
     */
protected static CTShape prototype() {
    final String drawNS = "http://schemas.microsoft.com/office/drawing/2010/main";
    if (prototype == null) {
        CTShape shape = CTShape.Factory.newInstance();
        CTShapeNonVisual nv = shape.addNewNvSpPr();
        CTNonVisualDrawingProps nvp = nv.addNewCNvPr();
        nvp.setId(1);
        nvp.setName("Shape 1");
        //            nvp.setHidden(true);
        CTOfficeArtExtensionList extLst = nvp.addNewExtLst();
        // https://msdn.microsoft.com/en-us/library/dd911027(v=office.12).aspx
        CTOfficeArtExtension ext = extLst.addNewExt();
        ext.setUri("{63B3BB69-23CF-44E3-9099-C40C66FF867C}");
        XmlCursor cur = ext.newCursor();
        cur.toEndToken();
        cur.beginElement(new QName(drawNS, "compatExt", "a14"));
        cur.insertNamespace("a14", drawNS);
        cur.insertAttributeWithValue("spid", "_x0000_s1");
        cur.dispose();
        nv.addNewCNvSpPr();
        CTShapeProperties sp = shape.addNewSpPr();
        CTTransform2D t2d = sp.addNewXfrm();
        CTPositiveSize2D p1 = t2d.addNewExt();
        p1.setCx(0);
        p1.setCy(0);
        CTPoint2D p2 = t2d.addNewOff();
        p2.setX(0);
        p2.setY(0);
        CTPresetGeometry2D geom = sp.addNewPrstGeom();
        geom.setPrst(STShapeType.RECT);
        geom.addNewAvLst();
        prototype = shape;
    }
    return prototype;
}
Also used : CTTransform2D(org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D) CTShapeProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties) QName(javax.xml.namespace.QName) CTShape(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShape) XmlCursor(org.apache.xmlbeans.XmlCursor) CTPoint2D(org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D) CTShapeNonVisual(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShapeNonVisual) CTPresetGeometry2D(org.openxmlformats.schemas.drawingml.x2006.main.CTPresetGeometry2D) CTNonVisualDrawingProps(org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps) CTOfficeArtExtension(org.openxmlformats.schemas.drawingml.x2006.main.CTOfficeArtExtension) CTPositiveSize2D(org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D) CTOfficeArtExtensionList(org.openxmlformats.schemas.drawingml.x2006.main.CTOfficeArtExtensionList)

Example 22 with CTShapeProperties

use of org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties in project poi by apache.

the class XSSFShape method setLineStyle.

/**
     * Sets the line style.
     *
     * @param lineStyle
     */
public void setLineStyle(int lineStyle) {
    CTShapeProperties props = getShapeProperties();
    CTLineProperties ln = props.isSetLn() ? props.getLn() : props.addNewLn();
    CTPresetLineDashProperties dashStyle = CTPresetLineDashProperties.Factory.newInstance();
    dashStyle.setVal(STPresetLineDashVal.Enum.forInt(lineStyle + 1));
    ln.setPrstDash(dashStyle);
}
Also used : CTShapeProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties) CTLineProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties) CTPresetLineDashProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTPresetLineDashProperties)

Aggregations

CTShapeProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties)21 CTPresetGeometry2D (org.openxmlformats.schemas.drawingml.x2006.main.CTPresetGeometry2D)9 CTNonVisualDrawingProps (org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps)8 XmlObject (org.apache.xmlbeans.XmlObject)6 CTTransform2D (org.openxmlformats.schemas.drawingml.x2006.main.CTTransform2D)5 CTBlipFillProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTBlipFillProperties)4 CTLineProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTLineProperties)4 CTPoint2D (org.openxmlformats.schemas.drawingml.x2006.main.CTPoint2D)4 CTPositiveSize2D (org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D)4 AffineTransform (java.awt.geom.AffineTransform)2 Rectangle2D (java.awt.geom.Rectangle2D)2 Test (org.junit.Test)2 CTAdjPoint2D (org.openxmlformats.schemas.drawingml.x2006.main.CTAdjPoint2D)2 CTBlip (org.openxmlformats.schemas.drawingml.x2006.main.CTBlip)2 CTCustomGeometry2D (org.openxmlformats.schemas.drawingml.x2006.main.CTCustomGeometry2D)2 CTNonVisualPictureProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualPictureProperties)2 CTPath2D (org.openxmlformats.schemas.drawingml.x2006.main.CTPath2D)2 CTPath2DCubicBezierTo (org.openxmlformats.schemas.drawingml.x2006.main.CTPath2DCubicBezierTo)2 CTPath2DQuadBezierTo (org.openxmlformats.schemas.drawingml.x2006.main.CTPath2DQuadBezierTo)2 CTSRgbColor (org.openxmlformats.schemas.drawingml.x2006.main.CTSRgbColor)2