@Internal protected XDDFTextParagraph(CTTextParagraph paragraph, XDDFTextBody parent) { this._p = paragraph; this._parent = parent; final int count = paragraph.sizeOfBrArray() + paragraph.sizeOfFldArray() + paragraph.sizeOfRArray(); this._runs = new ArrayList<>(count); for (XmlObject xo : _p.selectChildren(QNameSet.ALL)) { if (xo instanceof CTTextLineBreak) { _runs.add(new XDDFTextRun((CTTextLineBreak) xo, this)); } else if (xo instanceof CTTextField) { _runs.add(new XDDFTextRun((CTTextField) xo, this)); } else if (xo instanceof CTRegularTextRun) { _runs.add(new XDDFTextRun((CTRegularTextRun) xo, this)); } } addDefaultRunProperties(); addAfterLastRunProperties(); }
public void setText(String text) { // remove all runs for (int i = _p.sizeOfBrArray() - 1; i >= 0; i--) { _p.removeBr(i); } for (int i = _p.sizeOfFldArray() - 1; i >= 0; i--) { _p.removeFld(i); } for (int i = _p.sizeOfRArray() - 1; i >= 0; i--) { _p.removeR(i); } _runs.clear(); appendRegularRun(text); }
/** * Helper method for appending text and keeping paragraph and character properties. * The character properties are moved to the end paragraph marker */ /* package */ void clearButKeepProperties() { CTTextParagraph thisP = getXmlObject(); for (int i=thisP.sizeOfBrArray(); i>0; i--) { thisP.removeBr(i-1); } for (int i=thisP.sizeOfFldArray(); i>0; i--) { thisP.removeFld(i-1); } if (!_runs.isEmpty()) { int size = _runs.size(); XSLFTextRun lastRun = _runs.get(size-1); CTTextCharacterProperties cpOther = lastRun.getRPr(false); if (cpOther != null) { if (thisP.isSetEndParaRPr()) { thisP.unsetEndParaRPr(); } CTTextCharacterProperties cp = thisP.addNewEndParaRPr(); cp.set(cpOther); } for (int i=size; i>0; i--) { thisP.removeR(i-1); } _runs.clear(); } }
thisP.removeR(i-1); for (int i=thisP.sizeOfFldArray(); i>0; i--) { thisP.removeFld(i-1);
public void setText(String text) { // remove all runs for (int i = _p.sizeOfBrArray() - 1; i >= 0; i--) { _p.removeBr(i); } for (int i = _p.sizeOfFldArray() - 1; i >= 0; i--) { _p.removeFld(i); } for (int i = _p.sizeOfRArray() - 1; i >= 0; i--) { _p.removeR(i); } _runs.clear(); appendRegularRun(text); }
@Internal protected XDDFTextParagraph(CTTextParagraph paragraph, XDDFTextBody parent) { this._p = paragraph; this._parent = parent; final int count = paragraph.sizeOfBrArray() + paragraph.sizeOfFldArray() + paragraph.sizeOfRArray(); this._runs = new ArrayList<>(count); for (XmlObject xo : _p.selectChildren(QNameSet.ALL)) { if (xo instanceof CTTextLineBreak) { _runs.add(new XDDFTextRun((CTTextLineBreak) xo, this)); } else if (xo instanceof CTTextField) { _runs.add(new XDDFTextRun((CTTextField) xo, this)); } else if (xo instanceof CTRegularTextRun) { _runs.add(new XDDFTextRun((CTRegularTextRun) xo, this)); } } addDefaultRunProperties(); addAfterLastRunProperties(); }
/** * Helper method for appending text and keeping paragraph and character properties. * The character properties are moved to the end paragraph marker */ /* package */ void clearButKeepProperties() { CTTextParagraph thisP = getXmlObject(); for (int i=thisP.sizeOfBrArray(); i>0; i--) { thisP.removeBr(i-1); } for (int i=thisP.sizeOfFldArray(); i>0; i--) { thisP.removeFld(i-1); } if (!_runs.isEmpty()) { int size = _runs.size(); XSLFTextRun lastRun = _runs.get(size-1); CTTextCharacterProperties cpOther = lastRun.getRPr(false); if (cpOther != null) { if (thisP.isSetEndParaRPr()) { thisP.unsetEndParaRPr(); } CTTextCharacterProperties cp = thisP.addNewEndParaRPr(); cp.set(cpOther); } for (int i=size; i>0; i--) { thisP.removeR(i-1); } _runs.clear(); } }
thisP.removeR(i-1); for (int i=thisP.sizeOfFldArray(); i>0; i--) { thisP.removeFld(i-1);