diff --git a/src/java/org/apache/poi/hssf/record/RowRecord.java b/src/java/org/apache/poi/hssf/record/RowRecord.java index cbfc0ec59..46d4a1efe 100644 --- a/src/java/org/apache/poi/hssf/record/RowRecord.java +++ b/src/java/org/apache/poi/hssf/record/RowRecord.java @@ -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 diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFRow.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFRow.java index 7d3088d56..7134961f9 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFRow.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFRow.java @@ -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()); + } + } diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java index 3816c4cb6..1a678af68 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java @@ -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); } }