poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ye...@apache.org
Subject svn commit: r1243240 - in /poi/trunk/src: java/org/apache/poi/hssf/model/ java/org/apache/poi/hssf/usermodel/ ooxml/java/org/apache/poi/xssf/usermodel/ ooxml/testcases/org/apache/poi/xssf/streaming/ testcases/org/apache/poi/ss/usermodel/
Date Sun, 12 Feb 2012 11:14:23 GMT
Author: yegor
Date: Sun Feb 12 11:14:23 2012
New Revision: 1243240

URL: http://svn.apache.org/viewvc?rev=1243240&view=rev
Log:
Bugzilla 52626: fixed setting default row height in HSSF and XSSF

Modified:
    poi/trunk/src/java/org/apache/poi/hssf/model/InternalSheet.java
    poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFRow.java
    poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestRow.java
    poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java

Modified: poi/trunk/src/java/org/apache/poi/hssf/model/InternalSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/model/InternalSheet.java?rev=1243240&r1=1243239&r2=1243240&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/model/InternalSheet.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/model/InternalSheet.java Sun Feb 12 11:14:23 2012
@@ -1002,6 +1002,8 @@ public final class InternalSheet {
      */
     public void setDefaultRowHeight(short dch) {
         defaultrowheight.setRowHeight(dch);
+        // set the bit that specifies that the default settings for the row height have been
changed.
+        defaultrowheight.setOptionFlags((short)1);
     }
 
     /**

Modified: poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java?rev=1243240&r1=1243239&r2=1243240&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java Sun Feb 12 11:14:23 2012
@@ -197,6 +197,8 @@ public final class HSSFSheet implements 
     public HSSFRow createRow(int rownum)
     {
         HSSFRow row = new HSSFRow(_workbook, this, rownum);
+        // new rows inherit default height from the sheet
+        row.setHeight(getDefaultRowHeight());
 
         addRow(row, true);
         return row;

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java?rev=1243240&r1=1243239&r2=1243240&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java Sun Feb 12 11:14:23
2012
@@ -2060,8 +2060,7 @@ public class XSSFSheet extends POIXMLDoc
      * @param  height default row height in  twips (1/20 of  a point)
      */
     public void setDefaultRowHeight(short height) {
-        getSheetTypeSheetFormatPr().setDefaultRowHeight((double)height / 20);
-
+        setDefaultRowHeightInPoints((float)height / 20);
     }
 
     /**
@@ -2070,8 +2069,9 @@ public class XSSFSheet extends POIXMLDoc
      * @param height default row height measured in point size.
      */
     public void setDefaultRowHeightInPoints(float height) {
-        getSheetTypeSheetFormatPr().setDefaultRowHeight(height);
-
+        CTSheetFormatPr pr = getSheetTypeSheetFormatPr();
+        pr.setDefaultRowHeight(height);
+        pr.setCustomHeight(true);
     }
 
     /**

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFRow.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFRow.java?rev=1243240&r1=1243239&r2=1243240&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFRow.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/streaming/TestSXSSFRow.java Sun Feb
12 11:14:23 2012
@@ -19,6 +19,7 @@
 
 package org.apache.poi.xssf.streaming;
 
+import org.apache.poi.ss.SpreadsheetVersion;
 import org.apache.poi.ss.usermodel.BaseTestRow;
 import org.apache.poi.xssf.SXSSFITestDataProvider;
 
@@ -30,4 +31,13 @@ public final class TestSXSSFRow extends 
     public TestSXSSFRow() {
         super(SXSSFITestDataProvider.instance);
     }
+
+    public void testRowBounds() {
+        baseTestRowBounds(SpreadsheetVersion.EXCEL2007.getLastRowIndex());
+    }
+
+    public void testCellBounds() {
+        baseTestCellBounds(SpreadsheetVersion.EXCEL2007.getLastColumnIndex());
+    }
+
 }

Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestRow.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestRow.java?rev=1243240&r1=1243239&r2=1243240&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestRow.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestRow.java Sun Feb 12 11:14:23
2012
@@ -292,6 +292,7 @@ public abstract class BaseTestRow extend
         assertEquals(20*20, row1.getHeight());
 
         Row row2 = sheet.createRow(1);
+        assertEquals(sheet.getDefaultRowHeight(), row2.getHeight());
         row2.setHeight((short)310);
         assertEquals(310, row2.getHeight());
         assertEquals(310F/20, row2.getHeightInPoints(), 0F);

Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java?rev=1243240&r1=1243239&r2=1243240&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestSheet.java Sun Feb 12 11:14:23
2012
@@ -401,6 +401,10 @@ public abstract class BaseTestSheet exte
         assertEquals((short) 300, sheet.getDefaultRowHeight());
         assertEquals(15.0F, sheet.getDefaultRowHeightInPoints(), 0F);
 
+        Row row = sheet.createRow(1);
+        // new row inherits  default height from the sheet
+        assertEquals(sheet.getDefaultRowHeight(), row.getHeight());
+
         // Set a new default row height in twips and test getting the value in points
         sheet.setDefaultRowHeight((short) 360);
         assertEquals(18.0f, sheet.getDefaultRowHeightInPoints(), 0F);



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


Mime
View raw message