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-------
>    &gt; From: Will Glass-Husain &lt;[EMAIL PROTECTED]&gt;
>    &gt; Subject: Re: retrieving saved String value of formula
>    &gt; Sent: 25 Oct 2003 22:42:46
>    &gt;
>    &gt;  Thanks.  Actually it's the reverse I want.  I have an Excel
> spreadsheet that
>    &gt;  contains a formula returning a String.  I've a tool written in
Java
> that
>    &gt;  imports the data into a database.  My question is simple: how
hard
> is it to
>    &gt;  implement the retrieval of the calculated String in Java.  Is the
> calculated
>    &gt;  String stored (like the calculated double) when the Excel file is
> saved?
>    &gt;
>    &gt;  Thanks, WILL
>    &gt;
>    &gt;
>    &gt;  ----- Original Message -----
>    &gt;  From: &quot;Michael Zalewski&quot;
>    &gt;  To: &quot;POI Users List&quot;
>    &gt;  Sent: Friday, October 24, 2003 9:53 PM
>    &gt;  Subject: RE: retrieving saved String value of formula
>    &gt;
>    &gt;
>    &gt;  &gt; POI HSSF does not interpret your formula. There is no
> 'mini-interpreter'.
>    &gt;  If
>    &gt;  &gt; you see a value returned from .getValue(), it is because
Excel
> computed it
>    &gt;  &gt; before the template was saved.
>    &gt;  &gt;
>    &gt;  &gt; However, when you set a formula in a cell, your client
should
> recomputed
>    &gt;  the
>    &gt;  &gt; formula (after it receives the xls generated by POI). This
is
> because HSSF
>    &gt;  &gt; sets an internal flag on each worksheet that tells Excel to
> recomputed all
>    &gt;  &gt; formulas when the spreadsheet is opened.
>    &gt;  &gt;
>    &gt;  &gt; So it shouldn't be hard to implement the feature you need.
> Just put the
>    &gt;  &gt; formula in, and forget about the actual cell value.
>    &gt;  &gt;
>    &gt;  &gt; Michael Zalewski
>    &gt;  &gt;
>    &gt;  &gt; -----Original Message-----
>    &gt;  &gt; From: Will Glass-Husain [mailto:[EMAIL PROTECTED]
>    &gt;  &gt; Sent: Friday, October 24, 2003 8:52 PM
>    &gt;  &gt; To: POI Users List
>    &gt;  &gt; Subject: retrieving saved String value of formula
>    &gt;  &gt;
>    &gt;  &gt; Hi,
>    &gt;  &gt;
>    &gt;  &gt; I've been playing with the Formula support in the latest
POI.
> I can't
>    &gt;  quite
>    &gt;  &gt; tell from the &quot;Formula Support&quot; docs.  When I
> retrieve a value with
>    &gt;  &gt; FormulaRecord.getValue(), is this calculated by POI with a
>    &gt;  mini-interpreter,
>    &gt;  &gt; or was the saved value part of the XLS file.
>    &gt;  &gt;
>    &gt;  &gt; Part of the reason that I ask is that my import tool needs
to
> import some
>    &gt;  &gt; calculated cells that return Strings. (I'm already
> successfully doing this
>    &gt;  &gt; with calculated doubles).  I'm wondering if the saved String
> values are
>    &gt;  &gt; actually in the XLS file and how hard it would be to add
> support for this.
>    &gt;  &gt; Any pointers?
>    &gt;  &gt;
>    &gt;  &gt; Thanks,
>    &gt;  &gt;
>    &gt;  &gt; WILL
>    &gt;  &gt;
>    &gt;  &gt; _______________________________________
>    &gt;  &gt; Forio Business Simulations
>    &gt;  &gt; Will Glass-Husain
>    &gt;  &gt;
>    &gt;  &gt;
>    &gt;
>
 &gt; ---------------------------------------------------------------------
>    &gt;  &gt; To unsubscribe, e-mail:
> [EMAIL PROTECTED]
>    &gt;  &gt; For additional commands, e-mail:
> [EMAIL PROTECTED]
>    &gt;  &gt;
>    &gt;
>    &gt;
>
>
&gt;  ---------------------------------------------------------------------
>    &gt;  To unsubscribe, e-mail: [EMAIL PROTECTED]
>    &gt;  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]

Reply via email to