]> source.dussan.org Git - poi.git/commitdiff
Merged revisions 638786-638802,638805-638811,638813-638814,638816-639230,639233-63924...
authorNick Burch <nick@apache.org>
Tue, 5 Aug 2008 15:37:44 +0000 (15:37 +0000)
committerNick Burch <nick@apache.org>
Tue, 5 Aug 2008 15:37:44 +0000 (15:37 +0000)
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

src/documentation/content/xdocs/changes.xml
src/documentation/content/xdocs/slideshow/how-to-shapes.xml
src/documentation/content/xdocs/status.xml
src/java/org/apache/poi/hssf/record/RowRecord.java
src/java/org/apache/poi/hssf/usermodel/HSSFRow.java
src/testcases/org/apache/poi/hssf/usermodel/TestHSSFRow.java
src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java

index a37166aac56cada3fee7e511873d88b95c5a8354..ac5d2f636afc79efd157e1727a269656086483d3 100644 (file)
@@ -53,6 +53,8 @@
            <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>
index 7959eedaf60539eeb30a5f00df5d1b18ff3cd8fe..40ef32aa75e9616432d43fe7a734500f33b2e9c1 100644 (file)
@@ -46,6 +46,7 @@
                     <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 &lt; 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>
index 14d942dc193b905fad30cd6910d4e9ac21289bfc..a9e1cbdc6a8914715895ce4100a5c3580cba9c13 100644 (file)
@@ -50,6 +50,8 @@
            <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>
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 0ddac1f6dbec5ec020c1d9d177ff40c3e6bab482..9ad89c34a57fc2c83a92bba09441d97e74c245b8 100644 (file)
@@ -484,7 +484,14 @@ public final class HSSFRow implements Comparable, Row {
 
     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;
     }
 
     /**
@@ -494,7 +501,7 @@ public final class HSSFRow implements Comparable, Row {
 
     public float getHeightInPoints()
     {
-        return (row.getHeight() / 20);
+        return ((float)getHeight() / 20);
     }
 
     /**
index 3c8f3a87394f94145717fe96f1d78eb4e508613c..b09753bcbd1ec6127a7a31475854a12550315c37 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 6fcd384988e63461b552b217dfeba0ad91d32e65..2c8287f4bc9154a2d2fe1cd0a707c5b57039be2d 100644 (file)
@@ -847,8 +847,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);
        }
 }