]> source.dussan.org Git - poi.git/commitdiff
Fixed bug relating to rewriting empty workbooks. The aggregates were not being added...
authorGlen Stampoultzis <glens@apache.org>
Sun, 21 Sep 2003 09:58:24 +0000 (09:58 +0000)
committerGlen Stampoultzis <glens@apache.org>
Sun, 21 Sep 2003 09:58:24 +0000 (09:58 +0000)
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/branches/REL_2_BRANCH@353363 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/hssf/model/Sheet.java
src/testcases/org/apache/poi/hssf/data/blankworkbook.xls [new file with mode: 0644]

index 93eb1cd28d66d9ee562f0bc19478a8de6d950346..c0f07b829a28a6f6a4632a01d80eb36fe4b8b260 100644 (file)
@@ -235,9 +235,9 @@ public class Sheet implements Model
             }
             else if ( rec.getSid() == RowRecord.sid )
             {
-                RowRecord row = (RowRecord)rec;
-                if (!isfirstrow) rec = null; //only add the aggregate once
-                
+                RowRecord row = (RowRecord)rec;
+                if (!isfirstrow) rec = null; //only add the aggregate once
+
                 if ( isfirstrow )
                 {
                     retval.rows = new RowRecordsAggregate();
@@ -297,14 +297,16 @@ public class Sheet implements Model
             }
         }
         retval.records = records;
-        if (retval.rows == null)
-        {
-            retval.rows = new RowRecordsAggregate();
-        }
-        if (retval.cells == null)
-        {
-            retval.cells = new ValueRecordsAggregate();
-        }
+//        if (retval.rows == null)
+//        {
+//            retval.rows = new RowRecordsAggregate();
+//        }
+        retval.checkCells();
+        retval.checkRows();
+//        if (retval.cells == null)
+//        {
+//            retval.cells = new ValueRecordsAggregate();
+//        }
         log.log(log.DEBUG, "sheet createSheet (existing file) exited");
         return retval;
     }
@@ -1002,10 +1004,7 @@ public class Sheet implements Model
     {
         checkCells();
         log.logFormatted(log.DEBUG, "remove value record row,dimsloc %,%",
-                         new int[]
-        {
-            row, dimsloc
-        });
+                         new int[]{row, dimsloc} );
         loc = dimsloc;
         cells.removeCell(col);
 
diff --git a/src/testcases/org/apache/poi/hssf/data/blankworkbook.xls b/src/testcases/org/apache/poi/hssf/data/blankworkbook.xls
new file mode 100644 (file)
index 0000000..fcf734d
Binary files /dev/null and b/src/testcases/org/apache/poi/hssf/data/blankworkbook.xls differ