Search in sources :

Example 1 with CTTextBody

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

the class XSLFCommonSlideData method processShape.

private void processShape(CTGroupShape gs, List<DrawingTextBody> out) {
    for (CTShape shape : gs.getSpArray()) {
        CTTextBody ctTextBody = shape.getTxBody();
        if (ctTextBody == null) {
            continue;
        }
        DrawingTextBody textBody;
        CTApplicationNonVisualDrawingProps nvpr = shape.getNvSpPr().getNvPr();
        if (nvpr.isSetPh()) {
            textBody = new DrawingTextPlaceholder(ctTextBody, nvpr.getPh());
        } else {
            textBody = new DrawingTextBody(ctTextBody);
        }
        out.add(textBody);
    }
}
Also used : CTShape(org.openxmlformats.schemas.presentationml.x2006.main.CTShape) CTApplicationNonVisualDrawingProps(org.openxmlformats.schemas.presentationml.x2006.main.CTApplicationNonVisualDrawingProps) CTTextBody(org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody)

Example 2 with CTTextBody

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

the class XSLFTextShape method addNewTextParagraph.

/**
     * add a new paragraph run to this shape
     *
     * @return created paragraph run
     */
public XSLFTextParagraph addNewTextParagraph() {
    CTTextBody txBody = getTextBody(false);
    CTTextParagraph p;
    if (txBody == null) {
        txBody = getTextBody(true);
        p = txBody.getPArray(0);
        p.removeR(0);
    } else {
        p = txBody.addNewP();
    }
    XSLFTextParagraph paragraph = newTextParagraph(p);
    _paragraphs.add(paragraph);
    return paragraph;
}
Also used : CTTextParagraph(org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph) CTTextBody(org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody)

Example 3 with CTTextBody

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

the class XSLFTextShape method getTextBodyPr.

protected CTTextBodyProperties getTextBodyPr(boolean create) {
    CTTextBody textBody = getTextBody(create);
    if (textBody == null) {
        return null;
    }
    CTTextBodyProperties textBodyPr = textBody.getBodyPr();
    if (textBodyPr == null && create) {
        textBodyPr = textBody.addNewBodyPr();
    }
    return textBodyPr;
}
Also used : CTTextBody(org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody) CTTextBodyProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTTextBodyProperties)

Example 4 with CTTextBody

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

the class XSLFAutoShape method initTextBody.

protected static void initTextBody(CTTextBody txBody) {
    CTTextBodyProperties bodypr = txBody.addNewBodyPr();
    bodypr.setAnchor(STTextAnchoringType.T);
    bodypr.setRtlCol(false);
    CTTextParagraph p = txBody.addNewP();
    p.addNewPPr().setAlgn(STTextAlignType.L);
    CTTextCharacterProperties endPr = p.addNewEndParaRPr();
    endPr.setLang("en-US");
    endPr.setSz(1100);
    p.addNewR().setT("");
    txBody.addNewLstStyle();
}
Also used : CTTextParagraph(org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph) CTTextCharacterProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties) CTTextBodyProperties(org.openxmlformats.schemas.drawingml.x2006.main.CTTextBodyProperties)

Example 5 with CTTextBody

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

the class XSSFSimpleShape method prototype.

/**
     * Prototype with the default structure of a new auto-shape.
     */
protected static CTShape prototype() {
    if (prototype == null) {
        CTShape shape = CTShape.Factory.newInstance();
        CTShapeNonVisual nv = shape.addNewNvSpPr();
        CTNonVisualDrawingProps nvp = nv.addNewCNvPr();
        nvp.setId(1);
        nvp.setName("Shape 1");
        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();
        CTTextBody body = shape.addNewTxBody();
        CTTextBodyProperties bodypr = body.addNewBodyPr();
        bodypr.setAnchor(STTextAnchoringType.T);
        bodypr.setRtlCol(false);
        CTTextParagraph p = body.addNewP();
        p.addNewPPr().setAlgn(STTextAlignType.L);
        CTTextCharacterProperties endPr = p.addNewEndParaRPr();
        endPr.setLang("en-US");
        endPr.setSz(1100);
        CTSolidColorFillProperties scfpr = endPr.addNewSolidFill();
        scfpr.addNewSrgbClr().setVal(new byte[] { 0, 0, 0 });
        body.addNewLstStyle();
        prototype = shape;
    }
    return prototype;
}
Also used : CTShape(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShape) CTShapeNonVisual(org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShapeNonVisual)

Aggregations

CTTextBody (org.openxmlformats.schemas.drawingml.x2006.main.CTTextBody)9 CTTextParagraph (org.openxmlformats.schemas.drawingml.x2006.main.CTTextParagraph)3 CTTextBodyProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTTextBodyProperties)2 CTShape (org.openxmlformats.schemas.presentationml.x2006.main.CTShape)2 VerticalAlignment (org.apache.poi.sl.usermodel.VerticalAlignment)1 CTTitle (org.openxmlformats.schemas.drawingml.x2006.chart.CTTitle)1 CTTx (org.openxmlformats.schemas.drawingml.x2006.chart.CTTx)1 CTRegularTextRun (org.openxmlformats.schemas.drawingml.x2006.main.CTRegularTextRun)1 CTTableCell (org.openxmlformats.schemas.drawingml.x2006.main.CTTableCell)1 CTTextCharacterProperties (org.openxmlformats.schemas.drawingml.x2006.main.CTTextCharacterProperties)1 CTTextField (org.openxmlformats.schemas.drawingml.x2006.main.CTTextField)1 CTShape (org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShape)1 CTShapeNonVisual (org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTShapeNonVisual)1 CTApplicationNonVisualDrawingProps (org.openxmlformats.schemas.presentationml.x2006.main.CTApplicationNonVisualDrawingProps)1