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 Mui 2003-06-27 23:13:29 +00:00
parent 72e18903be
commit fa17a12b5b
1 changed files with 11 additions and 3 deletions

View File

@ -469,12 +469,20 @@ public class Sheet implements Model
numMergedRegions--;
if (rec.getNumAreas() == 0)
{
if (merged == rec)
mergedRecords.remove(pos);
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);
} else {
merged = null;
}
}
int removePos = ((Integer) mergedLocs.get(pos)).intValue();
records.remove(removePos);
mergedRecords.remove(pos);
mergedLocs.remove(pos);
//if we're not tracking merged records, kill the pointer to reset the state