use of org.apache.poi.hssf.record.SharedFormulaRecord in project poi by apache.
the class FormulaRecordAggregate method visitContainedRecords.
public void visitContainedRecords(RecordVisitor rv) {
rv.visitRecord(_formulaRecord);
Record sharedFormulaRecord = _sharedValueManager.getRecordForFirstCell(this);
if (sharedFormulaRecord != null) {
rv.visitRecord(sharedFormulaRecord);
}
if (_formulaRecord.hasCachedResultString() && _stringRecord != null) {
rv.visitRecord(_stringRecord);
}
}
use of org.apache.poi.hssf.record.SharedFormulaRecord in project poi by apache.
the class TestSharedValueManager method testCompletelyOverlappedRanges.
/**
* This bug occurs for similar reasons to the bug in {@link #testPartiallyOverlappingRanges()}
* but the symptoms are much uglier - serialization fails with {@link NullPointerException}.<br/>
*/
public void testCompletelyOverlappedRanges() {
Record[] records;
int attempt = 1;
do {
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook(SAMPLE_FILE_NAME);
HSSFSheet sheet = wb.getSheetAt(1);
try {
records = RecordInspector.getRecords(sheet, 0);
} catch (NullPointerException e) {
throw new AssertionFailedError("Identified bug " + "- cannot reserialize completely overlapped shared formula" + " (attempt " + attempt + ")");
}
} while (attempt++ < MAX_ATTEMPTS);
int count = 0;
for (Record record : records) {
if (record instanceof SharedFormulaRecord) {
count++;
}
}
assertEquals(2, count);
}
Aggregations