use of org.apache.poi.hssf.record.FormulaRecord in project poi by apache.
the class ValueRecordsAggregate method construct.
/**
* Processes a single cell value record
* @param sfh used to resolve any shared-formulas/arrays/tables for the current sheet
*/
public void construct(CellValueRecordInterface rec, RecordStream rs, SharedValueManager sfh) {
if (rec instanceof FormulaRecord) {
FormulaRecord formulaRec = (FormulaRecord) rec;
// read optional cached text value
StringRecord cachedText;
Class<? extends Record> nextClass = rs.peekNextClass();
if (nextClass == StringRecord.class) {
cachedText = (StringRecord) rs.getNext();
} else {
cachedText = null;
}
insertCell(new FormulaRecordAggregate(formulaRec, cachedText, sfh));
} else {
insertCell(rec);
}
}
use of org.apache.poi.hssf.record.FormulaRecord in project poi by apache.
the class TestSheet method testRowAggregation.
/**
* Makes sure all rows registered for this sheet are aggregated, they were being skipped
*
*/
@Test
public void testRowAggregation() {
List<Record> records = new ArrayList<Record>();
records.add(InternalSheet.createBOF());
records.add(new DimensionsRecord());
records.add(new RowRecord(0));
records.add(new RowRecord(1));
FormulaRecord formulaRecord = new FormulaRecord();
formulaRecord.setCachedResultTypeString();
records.add(formulaRecord);
records.add(new StringRecord());
records.add(new RowRecord(2));
records.add(createWindow2Record());
records.add(EOFRecord.instance);
InternalSheet sheet = createSheet(records);
assertNotNull("Row [2] was skipped", sheet.getRow(2));
}
Aggregations