← Back to team overview

dhis2-devs team mailing list archive

Re: How to get the calculated value from an input formula string ?

 

Hi

I don't know if I have the right understanding of this, but please do
remember that POI and JXL are only wrappers around the file format -
they do not replace the formula engine in the spreadsheet application.
So if you create a spreadsheet using your application (in combination
with the JXL or POI library) which has a formula in cell C1, then the
simple act of reading the cell value will not automatically calculate
it for you.

You would have to open the file in a spreadsheet application (excel,
openoffice, gnumeric or something similar) in order to trigger the
evaluation of formulae.  When you save again the calculated values
will be saved.  Or build your own formula engine which would be a
pretty big undertaking.  Though I suppose A1+B1 wouldn't be too bad
...

Regards
Bob

2009/6/29 Hieu Dang Duy <hieu.hispvietnam@xxxxxxxxx>:
> Oh, (so supsire) hi Murod !
>
> I mean which method in which class either POI or JXL using for input formula
> string ?
>
> Can u give an sample ?
>
> Thank a lot !
>
> On Mon, Jun 29, 2009 at 5:26 PM, Murodullo Latifov <murodlatifov@xxxxxxxxx>
> wrote:
>>
>> in POI place formula like this: A1 + B1 . Note no need for equal = sign.
>>
>> murod
>>
>> ________________________________
>> From: Hieu Dang Duy <hieu.hispvietnam@xxxxxxxxx>
>> To: dhis2-devs@xxxxxxxxxxxxxxxxxxx
>> Sent: Monday, June 29, 2009 11:23:35 AM
>> Subject: [Dhis2-devs] How to get the calculated value from an input
>> formula string ?
>>
>>
>> That's a question to resolve the problem as example below :
>>
>> I've got three cells as A1, B1 and C1
>>
>> A1 contains value as 8   (A1 = 8)
>> B1 contains value as 10 (B1 = 10)
>>
>> and:
>>
>> C1 = A1 + B1
>>
>> So, how can i get the calculated value as 18 from input formula string "A1
>> + B1" by jxl or POI
>>
>> p.s: I could not get directly the pre-calculated value from cell C1 by
>> jxl.
>>
>> Please giving me your experiences about the jxl or POI API !
>>
>> --
>> Hieu.HISPVietnam
>> Good Health !
>>
>
>
>
> --
> Hieu.HISPVietnam
> Good Health !
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>



Follow ups

References