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:
parent
f4ecdbb4ce
commit
0a6a844dda
@ -351,7 +351,7 @@ public class FormulaRecord
|
|||||||
int ptgSize = getTotalPtgSize();
|
int ptgSize = getTotalPtgSize();
|
||||||
|
|
||||||
LittleEndian.putShort(data, 0 + offset, sid);
|
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, 4 + offset, getRow());
|
||||||
LittleEndian.putShort(data, 6 + offset, getColumn());
|
LittleEndian.putShort(data, 6 + offset, getColumn());
|
||||||
LittleEndian.putShort(data, 8 + offset, getXFIndex());
|
LittleEndian.putShort(data, 8 + offset, getXFIndex());
|
||||||
@ -371,7 +371,7 @@ public class FormulaRecord
|
|||||||
int retval =0;
|
int retval =0;
|
||||||
|
|
||||||
if (EXPERIMENTAL_FORMULA_SUPPORT_ENABLED) {
|
if (EXPERIMENTAL_FORMULA_SUPPORT_ENABLED) {
|
||||||
retval = getTotalPtgSize() + 28;
|
retval = getTotalPtgSize() + 26;
|
||||||
} else {
|
} else {
|
||||||
retval =all_data.length;
|
retval =all_data.length;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ public class ValueRecordsAggregate
|
|||||||
int firstcell = -1;
|
int firstcell = -1;
|
||||||
int lastcell = -1;
|
int lastcell = -1;
|
||||||
TreeMap records = null;
|
TreeMap records = null;
|
||||||
int size = 0;
|
// int size = 0;
|
||||||
|
|
||||||
/** Creates a new instance of ValueRecordsAggregate */
|
/** Creates a new instance of ValueRecordsAggregate */
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ public class ValueRecordsAggregate
|
|||||||
|
|
||||||
public void insertCell(CellValueRecordInterface cell)
|
public void insertCell(CellValueRecordInterface cell)
|
||||||
{
|
{
|
||||||
if (records.get(cell) == null)
|
/* if (records.get(cell) == null)
|
||||||
{
|
{
|
||||||
size += (( Record ) cell).getRecordSize();
|
size += (( Record ) cell).getRecordSize();
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ public class ValueRecordsAggregate
|
|||||||
{
|
{
|
||||||
size += (( Record ) cell).getRecordSize()
|
size += (( Record ) cell).getRecordSize()
|
||||||
- (( Record ) records.get(cell)).getRecordSize();
|
- (( Record ) records.get(cell)).getRecordSize();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// XYLocator xy = new XYLocator(cell.getRow(), cell.getColumn());
|
// XYLocator xy = new XYLocator(cell.getRow(), cell.getColumn());
|
||||||
records.put(cell, cell);
|
records.put(cell, cell);
|
||||||
@ -113,7 +113,7 @@ public class ValueRecordsAggregate
|
|||||||
|
|
||||||
public void removeCell(CellValueRecordInterface cell)
|
public void removeCell(CellValueRecordInterface cell)
|
||||||
{
|
{
|
||||||
size -= (( Record ) cell).getRecordSize();
|
// size -= (( Record ) cell).getRecordSize();
|
||||||
|
|
||||||
// XYLocator xy = new XYLocator(cell.getRow(), cell.getColumn());
|
// XYLocator xy = new XYLocator(cell.getRow(), cell.getColumn());
|
||||||
records.remove(cell);
|
records.remove(cell);
|
||||||
@ -209,9 +209,17 @@ public class ValueRecordsAggregate
|
|||||||
return sid;
|
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;
|
||||||
|
// return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Iterator getIterator()
|
public Iterator getIterator()
|
||||||
|
Loading…
Reference in New Issue
Block a user