poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Zalewski <zalew...@optonline.net>
Subject RE: Re: retrieving saved String value of formula
Date Sun, 26 Oct 2003 00:36:18 GMT
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:avik.sengupta@itellix.com]
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;wglass@forio.com&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:wglass@forio.com]
   &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:
poi-user-unsubscribe@jakarta.apache.org
   &gt;  &gt; For additional commands, e-mail:
poi-user-help@jakarta.apache.org
   &gt;  &gt;
   &gt;
   &gt;

 &gt;  ---------------------------------------------------------------------
   &gt;  To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
   &gt;  For additional commands, e-mail: poi-user-help@jakarta.apache.org
   -------Original Message-------



---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-user-help@jakarta.apache.org


Mime
View raw message