https://svn.apache.org/repos/asf/poi/trunk
........
r682620 | yegor | 2008-08-05 09:05:54 +0100 (Tue, 05 Aug 2008) | 1 line
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
........
r682621 | yegor | 2008-08-05 09:06:50 +0100 (Tue, 05 Aug 2008) | 1 line
fixed bug #44692: HSSFPicture.resize() stretched image when there was a text next to it
........
git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@682760
13f79535-47bb-0310-9956-
ffa450edef68
<action dev="POI-DEVELOPERS" type="add">Created a common interface for handling Excel files, irrespective of if they are .xls or .xlsx</action>
</release>
<release version="3.1.1-alpha1" date="2008-??-??">
+ <action dev="POI-DEVELOPERS" type="fix">45472 - Fixed incorrect default row height in OpenOffice 2.3</action>
+ <action dev="POI-DEVELOPERS" type="fix">44692 - HSSFPicture.resize() stretched image when there was a text next to it</action>
<action dev="POI-DEVELOPERS" type="add">45543 - Optionally extract comment text with PowerPointExtractor, and initial hslf model support for comments</action>
<action dev="POI-DEVELOPERS" type="fix">45538 - Include excel headers and footers in the output of ExcelExtractor</action>
<action dev="POI-DEVELOPERS" type="fix">44894 - refactor duplicate logic from EventRecordFactory to RecordFactory</action>
<li><link href="#Freeform">How to create shapes of arbitrary geometry</link></li>
<li><link href="#Graphics2D">Shapes and Graphics2D</link></li>
<li><link href="#Render">How to convert slides into images</link></li>
+ <li><link href="#HeadersFooters">Headers / Footers</link></li>
</ul>
</section>
<section><title>Features</title>
</section>
</section>
+ <anchor id="HeadersFooters"/>
+ <section><title>How to extract Headers / Footers from an existing presentation</title>
+ <source>
+
+ FileInputStream is = new FileInputStream("slideshow.ppt");
+ SlideShow ppt = new SlideShow(is);
+ is.close();
+ Slide[] slides = ppt.getSlides();
+
+ //presentation-scope headers / footers
+ HeadersFooters hdd = ppt.getSlideHeadersFooters();
+ if(hdd.isFooterVisible()) {
+ String footerText = hdd.getFooterText();
+ }
+
+ //per-slide headers / footers
+ for (int i=0; i < slides.length; i++){
+ HeadersFooters hdd2 = slides[i].getHeadersFooters();
+ if(hdd2.isFooterVisible()) {
+ String footerText = hdd2.getFooterText();
+ }
+ if(hdd2.isUserDateVisible()) {
+ String customDate = hdd2.getDateTimeText();
+ }
+ if(hdd2.isSlideNumberVisible()){
+ int slideNUm = slides[i].getSlideNumber();
+ }
+
+ }
+ </source>
+ </section>
+ <section><title>How to set Headers / Footers</title>
+ <source>
+
+ SlideShow ppt = new SlideShow();
+
+ //presentation-scope headers / footers
+ HeadersFooters hdd = ppt.getSlideHeadersFooters();
+ hdd.setSlideNumberVisible(true);
+ hdd.setFootersText("Created by POI-HSLF");
+ </source>
+ </section>
</section>
</body>
</document>
<action dev="POI-DEVELOPERS" type="add">Created a common interface for handling Excel files, irrespective of if they are .xls or .xlsx</action>
</release>
<release version="3.1.1-alpha1" date="2008-??-??">
+ <action dev="POI-DEVELOPERS" type="fix">45472 - Fixed incorrect default row height in OpenOffice 2.3</action>
+ <action dev="POI-DEVELOPERS" type="fix">44692 - HSSFPicture.resize() stretched image when there was a text next to it</action>
<action dev="POI-DEVELOPERS" type="add">45543 - Optionally extract comment text with PowerPointExtractor, and initial hslf model support for comments</action>
<action dev="POI-DEVELOPERS" type="fix">45538 - Include excel headers and footers in the output of ExcelExtractor</action>
<action dev="POI-DEVELOPERS" type="fix">44894 - refactor duplicate logic from EventRecordFactory to RecordFactory</action>
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
public short getHeight()
{
- return row.getHeight();
+ short height = row.getHeight();
+
+ //The low-order 15 bits contain the row height.
+ //The 0x8000 bit indicates that the row is standard height (optional)
+ if ((height & 0x8000) != 0) height = sheet.getDefaultRowHeight();
+ else height &= 0x7FFF;
+
+ return height;
}
/**
public float getHeightInPoints()
{
- return (row.getHeight() / 20);
+ return ((float)getHeight() / 20);
}
/**
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());
+ }
+
}
}
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);
}
}