poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acoli...@apache.org
Subject svn commit: r544151 - in /jakarta/poi/trunk/src/java/org/apache/poi/hssf: model/Workbook.java usermodel/HSSFWorkbook.java
Date Mon, 04 Jun 2007 13:52:58 GMT
Author: acoliver
Date: Mon Jun  4 06:52:57 2007
New Revision: 544151

URL: http://svn.apache.org/viewvc?view=rev&rev=544151
Log:
http://issues.apache.org/bugzilla/show_bug.cgi?id=23951

Modified:
    jakarta/poi/trunk/src/java/org/apache/poi/hssf/model/Workbook.java
    jakarta/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java

Modified: jakarta/poi/trunk/src/java/org/apache/poi/hssf/model/Workbook.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/java/org/apache/poi/hssf/model/Workbook.java?view=diff&rev=544151&r1=544150&r2=544151
==============================================================================
--- jakarta/poi/trunk/src/java/org/apache/poi/hssf/model/Workbook.java (original)
+++ jakarta/poi/trunk/src/java/org/apache/poi/hssf/model/Workbook.java Mon Jun  4 06:52:57
2007
@@ -738,6 +738,7 @@
 
         SSTRecord sst = null;
         int sstPos = 0;
+        boolean wroteBoundSheets = false;
         for ( int k = 0; k < records.size(); k++ )
         {
 
@@ -745,6 +746,7 @@
             // Let's skip RECALCID records, as they are only use for optimization
             if ( record.getSid() != RecalcIdRecord.sid || ( (RecalcIdRecord) record ).isNeeded()
)
             {
+                int len = 0; 
                 if (record instanceof SSTRecord)
                 {
                     sst = (SSTRecord)record;
@@ -754,7 +756,17 @@
                 {
                     record = sst.createExtSSTRecord(sstPos + offset);
                 }
-                int len = record.serialize( pos + offset, data );
+                if (record instanceof BoundSheetRecord) {
+                     if(!wroteBoundSheets) {
+                        for (int i = 0; i < boundsheets.size(); i++) {
+                            len+= ((BoundSheetRecord)boundsheets.get(i))
+                                             .serialize(pos+offset+len, data);
+                        }
+                        wroteBoundSheets = true;
+                     }
+                } else {
+                   len = record.serialize( pos + offset, data );
+                }
                 /////  DEBUG BEGIN /////
 //                if (len != record.getRecordSize())
 //                    throw new IllegalStateException("Record size does not match serialized
bytes.  Serialized size = " + len + " but getRecordSize() returns " + record.getRecordSize());

Modified: jakarta/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java?view=diff&rev=544151&r1=544150&r2=544151
==============================================================================
--- jakarta/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java (original)
+++ jakarta/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFWorkbook.java Mon Jun  4
06:52:57 2007
@@ -321,6 +321,7 @@
      */
 
     public void setSheetOrder(String sheetname, int pos ) {
+        sheets.add(pos,sheets.remove(getSheetIndex(sheetname)));
         workbook.setSheetOrder(sheetname, pos);
     }
     



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Mime
View raw message