Thanks Avik and Michael. Appreciate the info that this may have been recently added. However, can you be a little more direct? Which method do you call to get the String that is the result of a formula in an Excel created and saved document. (No macros have been used, just human entry).
Specifically, I've a cell B91which has the formula "=G56". The result is a String. My debugging shows that a FormulaRecord is returned for this cell (I'm using the EventModel, as recommended in the docs). In FormulaRecord there's a getValue() method that returns a double (in this example, it returns NaN). The javadocs read: "get the calculated value of the formula". No sign of a parallel method that returns a SST index or StringRecord, even in CVS. What am I missing? Appreciate a pointer. Thanks, WILL ----- Original Message ----- From: "Michael Zalewski" <[EMAIL PROTECTED]> To: "POI Users List" <[EMAIL PROTECTED]>; "Avik Sengupta" <[EMAIL PROTECTED]> Sent: Saturday, October 25, 2003 5:36 PM Subject: RE: Re: retrieving saved String value of formula > If you load run the macro with the formula in Excel, then, yes, you will be > able to retrieve the String result of the formula using HSSF. > > If you load or change the data with HSSF, then you will also be able to put > the formula into the cell. But you will not be able to retrieve the result > of that formula. > > However, when your user opens the spreadsheet that you created with HSSF, he > or she will see the formula result, because HSSF makes Excel recalculate all > formulas the next time the worksheet is opened. > > > -----Original Message----- > From: Avik Sengupta [mailto:[EMAIL PROTECTED] > Sent: Saturday, October 25, 2003 2:38 PM > To: POI Users List > Subject: Re: Re: retrieving saved String value of formula > > I think we recently added in the ability to retrieve string forumula values. > I dont remember if it was before or after 2.0pre3 .. which version are you > using. > > > > -------Original Message------- > > From: Will Glass-Husain <[EMAIL PROTECTED]> > > Subject: Re: retrieving saved String value of formula > > Sent: 25 Oct 2003 22:42:46 > > > > Thanks. Actually it's the reverse I want. I have an Excel > spreadsheet that > > contains a formula returning a String. I've a tool written in Java > that > > imports the data into a database. My question is simple: how hard > is it to > > implement the retrieval of the calculated String in Java. Is the > calculated > > String stored (like the calculated double) when the Excel file is > saved? > > > > Thanks, WILL > > > > > > ----- Original Message ----- > > From: "Michael Zalewski" > > To: "POI Users List" > > Sent: Friday, October 24, 2003 9:53 PM > > Subject: RE: retrieving saved String value of formula > > > > > > > POI HSSF does not interpret your formula. There is no > 'mini-interpreter'. > > If > > > you see a value returned from .getValue(), it is because Excel > computed it > > > before the template was saved. > > > > > > However, when you set a formula in a cell, your client should > recomputed > > the > > > formula (after it receives the xls generated by POI). This is > because HSSF > > > sets an internal flag on each worksheet that tells Excel to > recomputed all > > > formulas when the spreadsheet is opened. > > > > > > So it shouldn't be hard to implement the feature you need. > Just put the > > > formula in, and forget about the actual cell value. > > > > > > Michael Zalewski > > > > > > -----Original Message----- > > > From: Will Glass-Husain [mailto:[EMAIL PROTECTED] > > > Sent: Friday, October 24, 2003 8:52 PM > > > To: POI Users List > > > Subject: retrieving saved String value of formula > > > > > > Hi, > > > > > > I've been playing with the Formula support in the latest POI. > I can't > > quite > > > tell from the "Formula Support" docs. When I > retrieve a value with > > > FormulaRecord.getValue(), is this calculated by POI with a > > mini-interpreter, > > > or was the saved value part of the XLS file. > > > > > > Part of the reason that I ask is that my import tool needs to > import some > > > calculated cells that return Strings. (I'm already > successfully doing this > > > with calculated doubles). I'm wondering if the saved String > values are > > > actually in the XLS file and how hard it would be to add > support for this. > > > Any pointers? > > > > > > Thanks, > > > > > > WILL > > > > > > _______________________________________ > > > Forio Business Simulations > > > Will Glass-Husain > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > -------Original Message------- > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
