FormulaRecord stores additional info along with formula expression that includes the result of formula evaluation. however only numeric values are currently parsed by FormulaRecord (String, boolean, blank, error are treated as unknown)
Created attachment 15355 [details] [PATCH] Enhancements to FormulaRecord for reading calculated value of formula Prior to this Patch, FormulaRecord ignored non numeric values (treated them as UNKNOWN). This patch modifies FormulaRecord so that it correctly identifies the type of the value and stores it. Testcases have been included in patch. Results were verified by running BiffView (since FormulaRecord.toString() has also been modified accordingly).
Created attachment 15394 [details] Updates to FormulaRecord and FormulaRecordAggregate Thanks to Avik for pointing out that String value of formula evaluation is stored in an external StringRecord in FormulaRecordAggregate. Accordingly, this patch improves over the previous patch by: 1. removing getStringValue from FormulaRecord 2. enhancing FormulaRecordAggregate api by adding the foll functions: public double getNumberValue() public boolean getBooleanValue() public byte getErrorCodeValue() public byte getValueType() public void setValue(double value) public void setValue(String value) public void setValue(boolean value) public void setValue(byte errorCode) 3. JUnit Tests for FormulaRecordAggregate have been added
This looks useful... even more useful if HSSFCell is patched to take advantage of it.
Ill look into it. We are making some reasonably major changes on the trunk at the moment, i see no reason why this cant be applied. Jason
I believe something like this has been applied to svn trunk. You can now get at the cached values of formula cells of all types