Wow... Fixed sizing bug 8592 -- see bug for details. Basically we couldn't

handle variable sized value records (formulas are the only one we do so far).
Now we're a bit less efficient (reiterate through all at the end for size
calculations), but it works and is probably more flexible.
PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352508 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew C. Oliver 2002-04-28 00:44:40 +00:00
parent b657b44ac5
commit 6f0fd19520
2 changed files with 16 additions and 8 deletions

View File

@ -351,7 +351,7 @@ public class FormulaRecord
int ptgSize = getTotalPtgSize();
LittleEndian.putShort(data, 0 + offset, sid);
LittleEndian.putShort(data, 2 + offset, ( short ) (24 + ptgSize));
LittleEndian.putShort(data, 2 + offset, ( short ) (22 + ptgSize));
LittleEndian.putShort(data, 4 + offset, getRow());
LittleEndian.putShort(data, 6 + offset, getColumn());
LittleEndian.putShort(data, 8 + offset, getXFIndex());
@ -371,7 +371,7 @@ public class FormulaRecord
int retval =0;
if (EXPERIMENTAL_FORMULA_SUPPORT_ENABLED) {
retval = getTotalPtgSize() + 28;
retval = getTotalPtgSize() + 26;
} else {
retval =all_data.length;
}

View File

@ -78,7 +78,7 @@ public class ValueRecordsAggregate
int firstcell = -1;
int lastcell = -1;
TreeMap records = null;
int size = 0;
// int size = 0;
/** Creates a new instance of ValueRecordsAggregate */
@ -89,7 +89,7 @@ public class ValueRecordsAggregate
public void insertCell(CellValueRecordInterface cell)
{
if (records.get(cell) == null)
/* if (records.get(cell) == null)
{
size += (( Record ) cell).getRecordSize();
}
@ -97,7 +97,7 @@ public class ValueRecordsAggregate
{
size += (( Record ) cell).getRecordSize()
- (( Record ) records.get(cell)).getRecordSize();
}
}*/
// XYLocator xy = new XYLocator(cell.getRow(), cell.getColumn());
records.put(cell, cell);
@ -113,7 +113,7 @@ public class ValueRecordsAggregate
public void removeCell(CellValueRecordInterface cell)
{
size -= (( Record ) cell).getRecordSize();
// size -= (( Record ) cell).getRecordSize();
// XYLocator xy = new XYLocator(cell.getRow(), cell.getColumn());
records.remove(cell);
@ -209,9 +209,17 @@ public class ValueRecordsAggregate
return sid;
}
public int getRecordSize()
{
public int getRecordSize() {
int size = 0;
Iterator irecs = records.values().iterator();
while (irecs.hasNext()) {
size += (( Record ) irecs.next()).getRecordSize();
}
return size;
// return size;
}
public Iterator getIterator()