XSLF: remove creation of empty paragraph in XSLFTextShape.addNewTextParagraph()
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1745100 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e48e4e771d
commit
dae1a761fd
@ -175,8 +175,15 @@ public abstract class XSLFTextShape extends XSLFSimpleShape
|
|||||||
* @return created paragraph run
|
* @return created paragraph run
|
||||||
*/
|
*/
|
||||||
public XSLFTextParagraph addNewTextParagraph() {
|
public XSLFTextParagraph addNewTextParagraph() {
|
||||||
CTTextBody txBody = getTextBody(true);
|
CTTextBody txBody = getTextBody(false);
|
||||||
CTTextParagraph p = txBody.addNewP();
|
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);
|
XSLFTextParagraph paragraph = new XSLFTextParagraph(p, this);
|
||||||
_paragraphs.add(paragraph);
|
_paragraphs.add(paragraph);
|
||||||
return paragraph;
|
return paragraph;
|
||||||
|
@ -194,7 +194,8 @@ public class TestXSLFAutoShape {
|
|||||||
assertEquals(1000, p.getXmlObject().getPPr().getLnSpc().getSpcPts().getVal());
|
assertEquals(1000, p.getXmlObject().getPPr().getLnSpc().getSpcPts().getVal());
|
||||||
assertFalse(p.getXmlObject().getPPr().getLnSpc().isSetSpcPct());
|
assertFalse(p.getXmlObject().getPPr().getLnSpc().isSetSpcPct());
|
||||||
|
|
||||||
assertFalse(p.getXmlObject().getPPr().isSetAlgn());
|
// align is set in autoshape prototype
|
||||||
|
assertTrue(p.getXmlObject().getPPr().isSetAlgn());
|
||||||
assertEquals(TextAlign.LEFT, p.getTextAlign());
|
assertEquals(TextAlign.LEFT, p.getTextAlign());
|
||||||
p.setTextAlign(TextAlign.LEFT);
|
p.setTextAlign(TextAlign.LEFT);
|
||||||
assertTrue(p.getXmlObject().getPPr().isSetAlgn());
|
assertTrue(p.getXmlObject().getPPr().isSetAlgn());
|
||||||
|
Loading…
Reference in New Issue
Block a user