]> source.dussan.org Git - poi.git/commitdiff
when a new RowRecord is created, the default row height shoud be 0xFF. The DEFAULT_HE...
authorYegor Kozlov <yegor@apache.org>
Tue, 5 Aug 2008 08:05:54 +0000 (08:05 +0000)
committerYegor Kozlov <yegor@apache.org>
Tue, 5 Aug 2008 08:05:54 +0000 (08:05 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@682620 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/record/RowRecord.java
src/testcases/org/apache/poi/hssf/usermodel/TestHSSFRow.java
src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java

index cbfc0ec59423d716caf30574781efc40d7656a21..46d4a1efebfc084116a66dd553d1a0ae0db38771 100644 (file)
@@ -63,8 +63,7 @@ public final class RowRecord extends Record implements Comparable {
         field_1_row_number = rowNumber;
         field_2_first_col = -1;
         field_3_last_col = -1;
-        field_4_height = (short)DEFAULT_HEIGHT_BIT;
-        field_4_height = (short)DEFAULT_HEIGHT_BIT;
+        field_4_height = (short)0xFF;
         field_5_optimize = ( short ) 0;
         field_6_reserved = ( short ) 0;
         field_7_option_flags = OPTION_BITS_ALWAYS_SET; // seems necessary for outlining
index 7d3088d5680a7cc670288d5bc118ed0b5b6cb63c..7134961f9d786ce9cddc27ab94af6d0df0162398 100644 (file)
@@ -277,4 +277,29 @@ public final class TestHSSFRow extends TestCase {
         assertEquals(null, row.getCell(4));
         assertEquals(HSSFCell.CELL_TYPE_NUMERIC, row.getCell(5).getCellType());
     }
+
+    public void testRowHeight() {
+        HSSFWorkbook workbook = new HSSFWorkbook();
+        HSSFSheet sheet = workbook.createSheet();
+        HSSFRow row1 = sheet.createRow( (short) 0);
+
+        assertEquals(0xFF, row1.getHeight());
+        assertEquals(sheet.getDefaultRowHeight(), row1.getHeight());
+
+        HSSFRow row2 = sheet.createRow( (short) 1);
+        row2.setHeight((short)400);
+
+        assertEquals(400, row2.getHeight());
+
+        workbook = HSSFTestDataSamples.writeOutAndReadBack(workbook);
+        sheet = workbook.getSheetAt(0);
+
+        row1 = sheet.getRow(0);
+        assertEquals(0xFF, row1.getHeight());
+        assertEquals(sheet.getDefaultRowHeight(), row1.getHeight());
+
+        row2 = sheet.getRow(1);
+        assertEquals(400, row2.getHeight());
+    }
+
 }
index 3816c4cb64ac4e2320b5c7c526683e4ded629916..1a678af6824b8870f0e5527e821b74345ca75316 100644 (file)
@@ -846,8 +846,8 @@ public final class TestHSSFSheet extends TestCase {
                }
                assertEquals("Hi Excel!", row.getCell(0).getRichStringCellValue().getString());
                // check row height for 'default' flag
-               assertEquals((short)0x8000, row.getHeight());
-               
+               assertEquals((short)0xFF, row.getHeight());
+
                HSSFTestDataSamples.writeOutAndReadBack(wb);
        }
 }