public void setText(String text) { if (_body.sizeOfPArray() > 0) { // remove all but first paragraph for (int i = _body.sizeOfPArray() - 1; i > 0; i--) { _body.removeP(i); } getParagraph(0).setText(text); } else { // as there were no paragraphs yet, initialize the text body initialize().setText(text); } }
@Override protected CTTextBody getTextBody(boolean create) { CTShape shape = (CTShape) getXmlObject(); CTTextBody txBody = shape.getTxBody(); if (txBody == null && create) { XDDFTextBody body = new XDDFTextBody(this); initTextBody(body); shape.setTxBody(body.getXmlObject()); txBody = shape.getTxBody(); } return txBody; }
public XDDFTextParagraph initialize() { _body.addNewLstStyle(); _body.addNewBodyPr(); XDDFBodyProperties bp = getBodyProperties(); bp.setAnchoring(AnchorType.TOP); bp.setRightToLeft(false); XDDFTextParagraph p = addNewParagraph(); p.setTextAlignment(TextAlignment.LEFT); XDDFRunProperties end = p.addAfterLastRunProperties(); end.setLanguage(Locale.US); end.setFontSize(11.0); return p; }
@Internal protected <R> Optional<R> findDefinedParagraphProperty(Function<CTTextParagraphProperties, Boolean> isSet, Function<CTTextParagraphProperties, R> getter, int level) { if (_body.isSetLstStyle() && level >= 0) { CTTextListStyle list = _body.getLstStyle(); CTTextParagraphProperties props = level == 0 ? list.getDefPPr() : retrieveProperties(list, level); if (props != null && isSet.apply(props)) { return Optional.of(getter.apply(props)); } else { return findDefinedParagraphProperty(isSet, getter, level - 1); } } else if (_parent != null) { return _parent.findDefinedParagraphProperty(isSet, getter); } else { return Optional.empty(); } }
/** * Sets the bottom inset. * * @see #getBottomInset() * * @param margin * the bottom margin */ public void setBottomInset(double margin) { if (margin == -1) { _textBody.getBodyProperties().setBottomInset(null); } else { _textBody.getBodyProperties().setBottomInset(margin); } }
public XDDFTextBody getTextBody() { if (legend.isSetTxPr()) { return new XDDFTextBody(this, legend.getTxPr()); } else { return null; } }
@Internal protected <R> Optional<R> findDefinedRunProperty(Function<CTTextCharacterProperties, Boolean> isSet, Function<CTTextCharacterProperties, R> getter, int level) { if (_body.isSetLstStyle() && level >= 0) { CTTextListStyle list = _body.getLstStyle(); CTTextParagraphProperties props = level == 0 ? list.getDefPPr() : retrieveProperties(list, level); if (props != null && props.isSetDefRPr() && isSet.apply(props.getDefRPr())) { return Optional.of(getter.apply(props.getDefRPr())); } else { return findDefinedRunProperty(isSet, getter, level - 1); } } else if (_parent != null) { return _parent.findDefinedRunProperty(isSet, getter); } else { return Optional.empty(); } }
geom.addNewAvLst(); XDDFTextBody body = new XDDFTextBody(null, shape.addNewTxBody()); XDDFTextParagraph p = body.initialize(); XDDFRunProperties rp = p.getAfterLastRunProperties(); XDDFColor black = new XDDFColorRgbBinary(new byte[] { 0, 0, 0 });
protected static void initTextBody(XDDFTextBody body) { XDDFTextParagraph p = body.getParagraph(0); p.appendRegularRun(""); }
private <R> Optional<R> findDefinedRunProperty(Function<CTTextCharacterProperties, Boolean> isSet, Function<CTTextCharacterProperties, R> getter, int level) { final CTTextCharacterProperties props = _p.getPPr().isSetDefRPr() ? _p.getPPr().getDefRPr() : null; if (props != null && isSet.apply(props)) { return Optional.ofNullable(getter.apply(props)); } else { return _parent.findDefinedRunProperty(isSet, getter, level); } } }
public void setTextBody(XDDFTextBody body) { if (body == null) { if (legend.isSetTxPr()) { legend.unsetTxPr(); } } else { legend.setTxPr(body.getXmlObject()); } }
private <R> Optional<R> findDefinedParagraphProperty(Function<CTTextParagraphProperties, Boolean> isSet, Function<CTTextParagraphProperties, R> getter, int level) { final CTTextParagraphProperties props = _p.getPPr(); if (props != null && isSet.apply(props)) { return Optional.ofNullable(getter.apply(props)); } else { return _parent.findDefinedParagraphProperty(isSet, getter, level); } }
public void setText(String text) { if (!title.isSetLayout()) { title.addNewLayout(); } getBody().setText(text); }
public XDDFTextBody(TextContainer parent) { this(parent, CTTextBody.Factory.newInstance()); initialize(); }
/** * Sets the left inset. * * @see #getLeftInset() * * @param margin * the left margin */ public void setLeftInset(double margin) { if (margin == -1) { _textBody.getBodyProperties().setLeftInset(null); } else { _textBody.getBodyProperties().setLeftInset(margin); } }
public XDDFTextBody getTextBody() { if (entry.isSetTxPr()) { return new XDDFTextBody(this, entry.getTxPr()); } else { return null; } }
@Internal protected <R> Optional<R> findDefinedParagraphProperty(Function<CTTextParagraphProperties, Boolean> isSet, Function<CTTextParagraphProperties, R> getter, int level) { if (_body.isSetLstStyle() && level >= 0) { CTTextListStyle list = _body.getLstStyle(); CTTextParagraphProperties props = level == 0 ? list.getDefPPr() : retrieveProperties(list, level); if (props != null && isSet.apply(props)) { return Optional.of(getter.apply(props)); } else { return findDefinedParagraphProperty(isSet, getter, level - 1); } } else if (_parent != null) { return _parent.findDefinedParagraphProperty(isSet, getter); } else { return Optional.empty(); } }
@Internal protected <R> Optional<R> findDefinedRunProperty(Function<CTTextCharacterProperties, Boolean> isSet, Function<CTTextCharacterProperties, R> getter, int level) { if (_body.isSetLstStyle() && level >= 0) { CTTextListStyle list = _body.getLstStyle(); CTTextParagraphProperties props = level == 0 ? list.getDefPPr() : retrieveProperties(list, level); if (props != null && props.isSetDefRPr() && isSet.apply(props.getDefRPr())) { return Optional.of(getter.apply(props.getDefRPr())); } else { return findDefinedRunProperty(isSet, getter, level - 1); } } else if (_parent != null) { return _parent.findDefinedRunProperty(isSet, getter); } else { return Optional.empty(); } }
geom.addNewAvLst(); XDDFTextBody body = new XDDFTextBody(null, shape.addNewTxBody()); XDDFTextParagraph p = body.initialize(); XDDFRunProperties rp = p.getAfterLastRunProperties(); XDDFColor black = new XDDFColorRgbBinary(new byte[] { 0, 0, 0 });
protected static void initTextBody(XDDFTextBody body) { XDDFTextParagraph p = body.getParagraph(0); p.appendRegularRun(""); }