when a new RowRecord is created, the default row height shoud be 0xFF. The DEFAULT_HEIGHT_BIT (0x8000) is optional, some clients like OpenOffice 2.3 and earlier don't understand it
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@682620 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c07944f2dc
commit
9a1077fd1d
@ -63,8 +63,7 @@ public final class RowRecord extends Record implements Comparable {
|
|||||||
field_1_row_number = rowNumber;
|
field_1_row_number = rowNumber;
|
||||||
field_2_first_col = -1;
|
field_2_first_col = -1;
|
||||||
field_3_last_col = -1;
|
field_3_last_col = -1;
|
||||||
field_4_height = (short)DEFAULT_HEIGHT_BIT;
|
field_4_height = (short)0xFF;
|
||||||
field_4_height = (short)DEFAULT_HEIGHT_BIT;
|
|
||||||
field_5_optimize = ( short ) 0;
|
field_5_optimize = ( short ) 0;
|
||||||
field_6_reserved = ( short ) 0;
|
field_6_reserved = ( short ) 0;
|
||||||
field_7_option_flags = OPTION_BITS_ALWAYS_SET; // seems necessary for outlining
|
field_7_option_flags = OPTION_BITS_ALWAYS_SET; // seems necessary for outlining
|
||||||
|
@ -277,4 +277,29 @@ public final class TestHSSFRow extends TestCase {
|
|||||||
assertEquals(null, row.getCell(4));
|
assertEquals(null, row.getCell(4));
|
||||||
assertEquals(HSSFCell.CELL_TYPE_NUMERIC, row.getCell(5).getCellType());
|
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());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -846,7 +846,7 @@ public final class TestHSSFSheet extends TestCase {
|
|||||||
}
|
}
|
||||||
assertEquals("Hi Excel!", row.getCell(0).getRichStringCellValue().getString());
|
assertEquals("Hi Excel!", row.getCell(0).getRichStringCellValue().getString());
|
||||||
// check row height for 'default' flag
|
// check row height for 'default' flag
|
||||||
assertEquals((short)0x8000, row.getHeight());
|
assertEquals((short)0xFF, row.getHeight());
|
||||||
|
|
||||||
HSSFTestDataSamples.writeOutAndReadBack(wb);
|
HSSFTestDataSamples.writeOutAndReadBack(wb);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user