fixed bug 53588

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1382339 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Evgeniy Berlog 2012-09-08 18:35:04 +00:00
parent 14eb4e44f6
commit 8a8bf7d393
3 changed files with 24 additions and 9 deletions

View File

@ -20,15 +20,7 @@ package org.apache.poi.hssf.eventusermodel;
import org.apache.poi.hssf.eventusermodel.dummyrecord.LastCellOfRowDummyRecord; import org.apache.poi.hssf.eventusermodel.dummyrecord.LastCellOfRowDummyRecord;
import org.apache.poi.hssf.eventusermodel.dummyrecord.MissingCellDummyRecord; import org.apache.poi.hssf.eventusermodel.dummyrecord.MissingCellDummyRecord;
import org.apache.poi.hssf.eventusermodel.dummyrecord.MissingRowDummyRecord; import org.apache.poi.hssf.eventusermodel.dummyrecord.MissingRowDummyRecord;
import org.apache.poi.hssf.record.BOFRecord; import org.apache.poi.hssf.record.*;
import org.apache.poi.hssf.record.CellValueRecordInterface;
import org.apache.poi.hssf.record.MulBlankRecord;
import org.apache.poi.hssf.record.MulRKRecord;
import org.apache.poi.hssf.record.NoteRecord;
import org.apache.poi.hssf.record.Record;
import org.apache.poi.hssf.record.RecordFactory;
import org.apache.poi.hssf.record.RowRecord;
import org.apache.poi.hssf.record.SharedFormulaRecord;
/** /**
* <p>A HSSFListener which tracks rows and columns, and will * <p>A HSSFListener which tracks rows and columns, and will
@ -72,6 +64,11 @@ public final class MissingRecordAwareHSSFListener implements HSSFListener {
thisRow = valueRec.getRow(); thisRow = valueRec.getRow();
thisColumn = valueRec.getColumn(); thisColumn = valueRec.getColumn();
} else { } else {
if (record instanceof StringRecord){
//it contains only cashed result of the previous FormulaRecord evaluation
childListener.processRecord(record);
return;
}
thisRow = -1; thisRow = -1;
thisColumn = -1; thisColumn = -1;

View File

@ -461,4 +461,22 @@ public final class TestMissingRecordAwareHSSFListener extends TestCase {
} }
assertEquals(2, eorCount); assertEquals(2, eorCount);
} }
public void testStringRecordHandling(){
readRecords("53588.xls");
Record[] rr = r;
int missingCount=0;
int lastCount=0;
for (int i = 0; i < rr.length; i++) {
Record record = rr[i];
if (record instanceof MissingCellDummyRecord) {
missingCount++;
}
if (record instanceof LastCellOfRowDummyRecord) {
lastCount++;
}
}
assertEquals(1, missingCount);
assertEquals(1, lastCount);
}
} }

Binary file not shown.