* @return created paragraph run
*/
public XSLFTextParagraph addNewTextParagraph() {
- CTTextBody txBody = getTextBody(true);
- CTTextParagraph p = txBody.addNewP();
+ 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 = new XSLFTextParagraph(p, this);
_paragraphs.add(paragraph);
return paragraph;
assertEquals(1000, p.getXmlObject().getPPr().getLnSpc().getSpcPts().getVal());\r
assertFalse(p.getXmlObject().getPPr().getLnSpc().isSetSpcPct());\r
\r
- assertFalse(p.getXmlObject().getPPr().isSetAlgn());\r
+ // align is set in autoshape prototype\r
+ assertTrue(p.getXmlObject().getPPr().isSetAlgn());\r
assertEquals(TextAlign.LEFT, p.getTextAlign());\r
p.setTextAlign(TextAlign.LEFT);\r
assertTrue(p.getXmlObject().getPPr().isSetAlgn());\r