You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ki...@apache.org on 2016/06/09 23:06:42 UTC

svn commit: r1747605 - in /poi: site/src/documentation/content/xdocs/status.xml trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java

Author: kiwiwings
Date: Thu Jun  9 23:06:42 2016
New Revision: 1747605

URL: http://svn.apache.org/viewvc?rev=1747605&view=rev
Log:
#59686 - Error when trying to access XSLFTableCell properties like textHeight, lineWidth, etc.

Modified:
    poi/site/src/documentation/content/xdocs/status.xml
    poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java

Modified: poi/site/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/site/src/documentation/content/xdocs/status.xml?rev=1747605&r1=1747604&r2=1747605&view=diff
==============================================================================
--- poi/site/src/documentation/content/xdocs/status.xml (original)
+++ poi/site/src/documentation/content/xdocs/status.xml Thu Jun  9 23:06:42 2016
@@ -40,6 +40,7 @@
     </devs>
 
     <release version="3.15-beta2" date="2016-07-??">
+        <action dev="PD" type="fix" fixes-bug="59686">XSLF: Error when trying to access XSLFTableCell properties like textHeight, lineWidth, etc.</action>
         <action dev="PD" type="add" fixes-bug="59170">Remove deprecated classes (POI 3.15) - remove BuiltinFormats.getBuiltinFormats()</action>
         <action dev="PD" type="add" fixes-bug="59638">SS Common: allow DataFormatter to use Locale-aware number grouping separator</action>
         <action dev="PD" type="add" fixes-bug="57766">XSLF: Table isn't exported on convert slides of a .pptx slide show to a PNG/SVG image</action>

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java?rev=1747605&r1=1747604&r2=1747605&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFTableCell.java Thu Jun  9 23:06:42 2016
@@ -41,6 +41,7 @@ import org.openxmlformats.schemas.drawin
 import org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTRegularTextRun;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTSchemeColor;
+import org.openxmlformats.schemas.drawingml.x2006.main.CTShapeProperties;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTSolidColorFillProperties;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTTable;
 import org.openxmlformats.schemas.drawingml.x2006.main.CTTableCell;
@@ -671,6 +672,19 @@ public class XSLFTableCell extends XSLFT
     }
 
     /**
+     * Return fake shape properties as a fallback for not overridden
+     * methods of XSLFSimpleShape
+     * 
+     * @return fake shape properties
+     * 
+     * @since POI 3.15-beta2
+     */
+    @Override
+    protected CTShapeProperties getSpPr() {
+        return CTShapeProperties.Factory.newInstance();
+    }
+    
+    /**
      * @since POI 3.15-beta2
      */
     private class XSLFCellTextParagraph extends XSLFTextParagraph {

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java?rev=1747605&r1=1747604&r2=1747605&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTable.java Thu Jun  9 23:06:42 2016
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertSam
 import static org.junit.Assert.assertTrue;
 
 import java.awt.Color;
+import java.awt.geom.Rectangle2D;
 import java.io.IOException;
 import java.util.List;
 
@@ -172,4 +173,22 @@ public class TestXSLFTable {
         
         ss2.close();
     }
+
+    @Test
+    public void checkTextHeight() throws IOException {
+        // from bug 59686
+        XMLSlideShow ppt = new XMLSlideShow();
+        XSLFSlide sl = ppt.createSlide();
+        XSLFTable tab = sl.createTable();
+        tab.setAnchor(new Rectangle2D.Double(50,50,300,50));
+        XSLFTableRow tr = tab.addRow();
+        XSLFTableCell tc0 = tr.addCell();
+        tc0.setText("bla bla bla bla");
+        tab.setColumnWidth(0, 50);
+        
+        assertEquals(88, tc0.getTextHeight(), 0);
+        assertEquals(0, tc0.getLineWidth(), 0);
+        
+        ppt.close();
+    }
 }
\ No newline at end of file



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