Fixing future bug when we support continue records for more than xxxx merged

regions.  Fetch the last merged record as the merged pointer if the current
one is killed.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353167 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Danny Muid 2003-06-27 23:13:29 +00:00
parent fb6c7e85de
commit 92bc16cca1

View File

@ -469,12 +469,20 @@ public class Sheet implements Model
numMergedRegions--; numMergedRegions--;
if (rec.getNumAreas() == 0) if (rec.getNumAreas() == 0)
{ {
mergedRecords.remove(pos);
if (merged == rec) if (merged == rec) {
//pull up the LAST record for operations when we finally
//support continue records for mergedRegions
if (mergedRecords.size() > 0) {
merged = (MergeCellsRecord) mergedRecords.get(mergedRecords.size() - 1); merged = (MergeCellsRecord) mergedRecords.get(mergedRecords.size() - 1);
} else {
merged = null;
}
}
int removePos = ((Integer) mergedLocs.get(pos)).intValue(); int removePos = ((Integer) mergedLocs.get(pos)).intValue();
records.remove(removePos); records.remove(removePos);
mergedRecords.remove(pos);
mergedLocs.remove(pos); mergedLocs.remove(pos);
//if we're not tracking merged records, kill the pointer to reset the state //if we're not tracking merged records, kill the pointer to reset the state