poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kiwiwi...@apache.org
Subject svn commit: r1745100 - in /poi/trunk/src/ooxml: java/org/apache/poi/xslf/usermodel/XSLFTextShape.java testcases/org/apache/poi/xslf/usermodel/TestXSLFAutoShape.java
Date Sun, 22 May 2016 23:57:14 GMT
Author: kiwiwings
Date: Sun May 22 23:57:14 2016
New Revision: 1745100

URL: http://svn.apache.org/viewvc?rev=1745100&view=rev
Log:
XSLF: remove creation of empty paragraph in XSLFTextShape.addNewTextParagraph()

Modified:
    poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextShape.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFAutoShape.java

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextShape.java?rev=1745100&r1=1745099&r2=1745100&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextShape.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTextShape.java Sun May 22 23:57:14
2016
@@ -175,8 +175,15 @@ public abstract class XSLFTextShape exte
      * @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;

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFAutoShape.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFAutoShape.java?rev=1745100&r1=1745099&r2=1745100&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFAutoShape.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFAutoShape.java Sun
May 22 23:57:14 2016
@@ -194,7 +194,8 @@ public class TestXSLFAutoShape {
         assertEquals(1000, p.getXmlObject().getPPr().getLnSpc().getSpcPts().getVal());
         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());
         p.setTextAlign(TextAlign.LEFT);
         assertTrue(p.getXmlObject().getPPr().isSetAlgn());



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message