poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Avik Sengupta <avik.sengu...@itellix.com>
Subject Re: How to get cell formula value when reading Excel file with EventModel.
Date Tue, 16 Jan 2007 08:41:54 GMT
You'll get a FormulaRecordAggregate. From here, you can get  the parsed (RPN) 
formula notation. However, since formula's contain references to other parts 
of the file, you'll need a reference to a workbook to get a string 
representation. The method is FormulaParser#toFormulaString(Workbook, List)

See HSSFCell#getCellFormula to see how its done. 

So that is a problem as far as using EventModel.... you can try to call the 
method with with an empty/dummy workbook reference, it MAY work for formulas 
without Names or 3D references, but be sure to catch all exceptions if you do 
that.. it might bomb horribly... 

In the general case, getting the formula string requires access to multiple 
parts of the file, so AFAICS, you cannot, theoretically, get at the formula 
string while purely streaming...

Regards
-
Avik




On Tuesday 16 January 2007 13:54, Khanh Tran wrote:
> Dear experts,
> I am using POI EventModel to read Excel file. All things works fiine but I
> could not get the value with formula cell.
> Is there any advice?
> Thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Mime
View raw message