Fixed bug 10943

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352785 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Glen Stampoultzis 2002-07-20 07:49:19 +00:00
parent 9d4c978b04
commit 080d3bf414
2 changed files with 67 additions and 61 deletions

View File

@ -93,8 +93,7 @@ public class Sheet
extends java.lang.Object extends java.lang.Object
{ {
protected ArrayList records = null; protected ArrayList records = null;
int preoffset = int preoffset = 0; // offset of the sheet in a new file
0; // offset of the sheet in a new file
int loc = 0; int loc = 0;
protected boolean containsLabels = false; protected boolean containsLabels = false;
; ;
@ -103,9 +102,9 @@ public class Sheet
protected DefaultColWidthRecord defaultcolwidth = null; protected DefaultColWidthRecord defaultcolwidth = null;
protected DefaultRowHeightRecord defaultrowheight = null; protected DefaultRowHeightRecord defaultrowheight = null;
protected GridsetRecord gridset = null; protected GridsetRecord gridset = null;
protected PrintSetupRecord printSetup = null; protected PrintSetupRecord printSetup = null;
protected HeaderRecord header = null; protected HeaderRecord header = null;
protected FooterRecord footer = null; protected FooterRecord footer = null;
protected PrintGridlinesRecord printGridlines = null; protected PrintGridlinesRecord printGridlines = null;
protected MergeCellsRecord merged = null; protected MergeCellsRecord merged = null;
protected int mergedloc = 0; protected int mergedloc = 0;
@ -201,13 +200,13 @@ public class Sheet
{ {
retval.defaultrowheight = ( DefaultRowHeightRecord ) rec; retval.defaultrowheight = ( DefaultRowHeightRecord ) rec;
} }
else if (rec.isValue()) else if ( rec.isValue() )
{ {
if (isfirstcell) if ( isfirstcell )
{ {
retval.cells = new ValueRecordsAggregate(); retval.cells = new ValueRecordsAggregate();
rec = retval.cells; rec = retval.cells;
retval.cells.construct(k, recs); retval.cells.construct( k, recs );
isfirstcell = false; isfirstcell = false;
} }
else else
@ -215,13 +214,13 @@ public class Sheet
rec = null; rec = null;
} }
} }
else if (rec.getSid() == RowRecord.sid) else if ( rec.getSid() == RowRecord.sid )
{ {
if (isfirstrow) if ( isfirstrow )
{ {
retval.rows = new RowRecordsAggregate(); retval.rows = new RowRecordsAggregate();
rec = retval.rows; rec = retval.rows;
retval.rows.construct(k, recs); retval.rows.construct( k, recs );
isfirstrow = false; isfirstrow = false;
} }
else else
@ -229,22 +228,22 @@ public class Sheet
rec = null; rec = null;
} }
} }
else if (rec.getSid () == PrintGridlinesRecord.sid) else if ( rec.getSid() == PrintGridlinesRecord.sid )
{ {
retval.printGridlines = (PrintGridlinesRecord) rec; retval.printGridlines = (PrintGridlinesRecord) rec;
} }
else if (rec.getSid () == HeaderRecord.sid) else if ( rec.getSid() == HeaderRecord.sid )
{ {
retval.header = (HeaderRecord) rec; retval.header = (HeaderRecord) rec;
} }
else if (rec.getSid () == FooterRecord.sid) else if ( rec.getSid() == FooterRecord.sid )
{ {
retval.footer = (FooterRecord) rec; retval.footer = (FooterRecord) rec;
} }
else if (rec.getSid () == PrintSetupRecord.sid) else if ( rec.getSid() == PrintSetupRecord.sid )
{ {
retval.printSetup = (PrintSetupRecord) rec; retval.printSetup = (PrintSetupRecord) rec;
} }
if (rec != null) if (rec != null)
{ {
@ -290,32 +289,32 @@ public class Sheet
// records.add(retval.createIndex()); // records.add(retval.createIndex());
records.add(retval.createCalcMode()); records.add(retval.createCalcMode());
records.add(retval.createCalcCount()); records.add(retval.createCalcCount() );
records.add(retval.createRefMode()); records.add( retval.createRefMode() );
records.add(retval.createIteration()); records.add( retval.createIteration() );
records.add(retval.createDelta()); records.add( retval.createDelta() );
records.add(retval.createSaveRecalc()); records.add( retval.createSaveRecalc() );
records.add(retval.createPrintHeaders()); records.add( retval.createPrintHeaders() );
retval.printGridlines = (PrintGridlinesRecord) retval.createPrintGridlines (); retval.printGridlines = (PrintGridlinesRecord) retval.createPrintGridlines();
records.add (retval.printGridlines); records.add( retval.printGridlines );
retval.gridset = ( GridsetRecord ) retval.createGridset(); retval.gridset = (GridsetRecord) retval.createGridset();
records.add(retval.gridset); records.add( retval.gridset );
records.add(retval.createGuts()); records.add( retval.createGuts() );
retval.defaultrowheight = retval.defaultrowheight =
( DefaultRowHeightRecord ) retval.createDefaultRowHeight(); (DefaultRowHeightRecord) retval.createDefaultRowHeight();
records.add(retval.defaultrowheight); records.add( retval.defaultrowheight );
records.add(retval.createWSBool()); records.add( retval.createWSBool() );
retval.header = (HeaderRecord) retval.createHeader (); retval.header = (HeaderRecord) retval.createHeader();
records.add (retval.header); records.add( retval.header );
retval.footer = (FooterRecord) retval.createFooter (); retval.footer = (FooterRecord) retval.createFooter();
records.add (retval.footer); records.add( retval.footer );
records.add(retval.createHCenter()); records.add( retval.createHCenter() );
records.add(retval.createVCenter()); records.add( retval.createVCenter() );
retval.printSetup = (PrintSetupRecord) retval.createPrintSetup (); retval.printSetup = (PrintSetupRecord) retval.createPrintSetup();
records.add (retval.printSetup); records.add( retval.printSetup );
retval.defaultcolwidth = retval.defaultcolwidth =
( DefaultColWidthRecord ) retval.createDefaultColWidth(); (DefaultColWidthRecord) retval.createDefaultColWidth();
records.add(retval.defaultcolwidth); records.add( retval.defaultcolwidth);
retval.dims = ( DimensionsRecord ) retval.createDimensions(); retval.dims = ( DimensionsRecord ) retval.createDimensions();
retval.dimsloc = 19; retval.dimsloc = 19;
records.add(retval.dims); records.add(retval.dims);

View File

@ -165,16 +165,23 @@ public class HSSFSheet
long cellstart = System.currentTimeMillis(); long cellstart = System.currentTimeMillis();
HSSFRow hrow = lastrow; HSSFRow hrow = lastrow;
if ((lastrow == null) || (lastrow.getRowNum() != cval.getRow())) if ( ( lastrow == null ) || ( lastrow.getRowNum() != cval.getRow() ) )
{ {
hrow = getRow(cval.getRow()); hrow = getRow( cval.getRow() );
}
if ( hrow != null )
{
lastrow = hrow;
log.log( DEBUG, "record id = " + Integer.toHexString( ( (Record) cval ).getSid() ) );
hrow.createCellFromRecord( cval );
cval = sheet.getNextValueRecord();
log.log( DEBUG, "record took ",
new Long( System.currentTimeMillis() - cellstart ) );
}
else
{
cval = null;
} }
lastrow = hrow;
log.log(DEBUG, "record id = "+ Integer.toHexString(((Record)cval).getSid()));
hrow.createCellFromRecord(cval);
cval = sheet.getNextValueRecord();
log.log(DEBUG, "record took ",
new Long(System.currentTimeMillis() - cellstart));
} }
log.log(DEBUG, "total sheet cell creation took ", log.log(DEBUG, "total sheet cell creation took ",
new Long(System.currentTimeMillis() - timestart)); new Long(System.currentTimeMillis() - timestart));