Fixed bug relating to rewriting empty workbooks. The aggregates were not being added to the records in this case.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/branches/REL_2_BRANCH@353363 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Glen Stampoultzis 2003-09-21 09:58:24 +00:00
parent 4cd31ff316
commit 2b241e6823
2 changed files with 14 additions and 15 deletions

View 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);