You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Karl-Heinz Zengerle <ka...@sawag.com> on 2004/03/08 18:02:01 UTC

evaluating simple formula

Hi world.
 
I see methods to retrieve the formula but I'ld need the results. What do
I have to do?
 
Regards,
Karl-Heinz Zengerle
 

Re: evaluating simple formula

Posted by av...@itellix.com.
Call getStringValue or getNumericValue on the cell.

Quoting Karl-Heinz Zengerle <ka...@sawag.com>:

> Hi world.
>  
> I see methods to retrieve the formula but I'ld need the results. What do
> I have to do?
>  
> Regards,
> Karl-Heinz Zengerle
>  
> 





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


AW: AW: AW: evaluating simple formula

Posted by Karl-Heinz Zengerle <ka...@sawag.com>.
Thanks Avik.

That'll help a lot. The user can input anything in any cell but in our
application we've an expected type and then expect that the result is
nonempty.

So in our application a wrong type will result in an empty string and
that we recognize.

Regards,	Karl-Heinz.


-----Ursprüngliche Nachricht-----
Von: Avik Sengupta [mailto:avik.sengupta@itellix.com] 
Gesendet: Donnerstag, 11. März 2004 13:16
An: POI Users List
Betreff: Re: AW: AW: evaluating simple formula

OK, sorry, I didnt have the code in front of me...

currently you have to do trial and error... and it doesnt throw an
exception :(. If its a numeric formula, getStringValue will return ""
and if it's a string formula, getNumberValue will return 0 !!

I thought it was user friendly to ensure that the poi client code will
not throw null pointer exceptions, but maybe not .. the basic assumption
i suppose was that one would know what kind of data a cell has, but
again, maybe not!

So maybe this could do with some refactoring!

HTH
-
Avik


On Mon, 2004-03-08 at 23:27, Karl-Heinz Zengerle wrote:
> Hi Avik.
> 
> For normal cells I've got the cell type. In case of formulas it's
> CELL_TYPE_FORMULA (or something like that). So the result type is
> hidden.
> 
> I can do the trial & error method. Loading with one method for a
> certain. If an exception occurs trying the next type, e.g. 1 numeric 2
> date 3 string.
> 
> Regards,	Karl-Heinz.
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: avik.sengupta@itellix.com [mailto:avik.sengupta@itellix.com] 
> Gesendet: Dienstag, 9. März 2004 00:57
> An: POI Users List
> Betreff: Re: AW: evaluating simple formula
> 
> Same way you do for a normal cell.. sorry its midnight, and I dont
have
> the api
> open in front of me... 
> 
> Quoting Karl-Heinz Zengerle <ka...@sawag.com>:
> 
> > Thanks for the quick answer Avik.
> > 
> > How do I know to which type the formula will result?
> > 
> > Regards,	Karl-Heinz.
> > 
> > 
> > -----Ursprüngliche Nachricht-----
> > Von: avik.sengupta@itellix.com [mailto:avik.sengupta@itellix.com] 
> > Gesendet: Dienstag, 9. März 2004 00:32
> > An: POI Users List
> > Betreff: Re: evaluating simple formula
> > 
> > Call getStringValue or getNumericValue on the cell.
> > 
> > Quoting Karl-Heinz Zengerle <ka...@sawag.com>:
> > 
> > > Hi world.
> > >  
> > > I see methods to retrieve the formula but I'ld need the results.
> What
> > do
> > > I have to do?
> > >  
> > > Regards,
> > > Karl-Heinz Zengerle
> > >  
> > > 
> > 
> > 
> > 
> > 
> > 
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: poi-user-help@jakarta.apache.org
> > 
> > 
> >
---------------------------------------------------------------------
> > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: poi-user-help@jakarta.apache.org
> > 
> > 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org
> 


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


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


Re: AW: AW: evaluating simple formula

Posted by Avik Sengupta <av...@itellix.com>.
OK, sorry, I didnt have the code in front of me...

currently you have to do trial and error... and it doesnt throw an
exception :(. If its a numeric formula, getStringValue will return ""
and if it's a string formula, getNumberValue will return 0 !!

I thought it was user friendly to ensure that the poi client code will
not throw null pointer exceptions, but maybe not .. the basic assumption
i suppose was that one would know what kind of data a cell has, but
again, maybe not!

So maybe this could do with some refactoring!

HTH
-
Avik


On Mon, 2004-03-08 at 23:27, Karl-Heinz Zengerle wrote:
> Hi Avik.
> 
> For normal cells I've got the cell type. In case of formulas it's
> CELL_TYPE_FORMULA (or something like that). So the result type is
> hidden.
> 
> I can do the trial & error method. Loading with one method for a
> certain. If an exception occurs trying the next type, e.g. 1 numeric 2
> date 3 string.
> 
> Regards,	Karl-Heinz.
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: avik.sengupta@itellix.com [mailto:avik.sengupta@itellix.com] 
> Gesendet: Dienstag, 9. März 2004 00:57
> An: POI Users List
> Betreff: Re: AW: evaluating simple formula
> 
> Same way you do for a normal cell.. sorry its midnight, and I dont have
> the api
> open in front of me... 
> 
> Quoting Karl-Heinz Zengerle <ka...@sawag.com>:
> 
> > Thanks for the quick answer Avik.
> > 
> > How do I know to which type the formula will result?
> > 
> > Regards,	Karl-Heinz.
> > 
> > 
> > -----Ursprüngliche Nachricht-----
> > Von: avik.sengupta@itellix.com [mailto:avik.sengupta@itellix.com] 
> > Gesendet: Dienstag, 9. März 2004 00:32
> > An: POI Users List
> > Betreff: Re: evaluating simple formula
> > 
> > Call getStringValue or getNumericValue on the cell.
> > 
> > Quoting Karl-Heinz Zengerle <ka...@sawag.com>:
> > 
> > > Hi world.
> > >  
> > > I see methods to retrieve the formula but I'ld need the results.
> What
> > do
> > > I have to do?
> > >  
> > > Regards,
> > > Karl-Heinz Zengerle
> > >  
> > > 
> > 
> > 
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: poi-user-help@jakarta.apache.org
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: poi-user-help@jakarta.apache.org
> > 
> > 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org
> 


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


AW: AW: evaluating simple formula

Posted by Karl-Heinz Zengerle <ka...@sawag.com>.
Hi Avik.

For normal cells I've got the cell type. In case of formulas it's
CELL_TYPE_FORMULA (or something like that). So the result type is
hidden.

I can do the trial & error method. Loading with one method for a
certain. If an exception occurs trying the next type, e.g. 1 numeric 2
date 3 string.

Regards,	Karl-Heinz.


-----Ursprüngliche Nachricht-----
Von: avik.sengupta@itellix.com [mailto:avik.sengupta@itellix.com] 
Gesendet: Dienstag, 9. März 2004 00:57
An: POI Users List
Betreff: Re: AW: evaluating simple formula

Same way you do for a normal cell.. sorry its midnight, and I dont have
the api
open in front of me... 

Quoting Karl-Heinz Zengerle <ka...@sawag.com>:

> Thanks for the quick answer Avik.
> 
> How do I know to which type the formula will result?
> 
> Regards,	Karl-Heinz.
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: avik.sengupta@itellix.com [mailto:avik.sengupta@itellix.com] 
> Gesendet: Dienstag, 9. März 2004 00:32
> An: POI Users List
> Betreff: Re: evaluating simple formula
> 
> Call getStringValue or getNumericValue on the cell.
> 
> Quoting Karl-Heinz Zengerle <ka...@sawag.com>:
> 
> > Hi world.
> >  
> > I see methods to retrieve the formula but I'ld need the results.
What
> do
> > I have to do?
> >  
> > Regards,
> > Karl-Heinz Zengerle
> >  
> > 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org
> 
> 





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


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


Re: AW: evaluating simple formula

Posted by av...@itellix.com.
Same way you do for a normal cell.. sorry its midnight, and I dont have the api
open in front of me... 

Quoting Karl-Heinz Zengerle <ka...@sawag.com>:

> Thanks for the quick answer Avik.
> 
> How do I know to which type the formula will result?
> 
> Regards,	Karl-Heinz.
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: avik.sengupta@itellix.com [mailto:avik.sengupta@itellix.com] 
> Gesendet: Dienstag, 9. März 2004 00:32
> An: POI Users List
> Betreff: Re: evaluating simple formula
> 
> Call getStringValue or getNumericValue on the cell.
> 
> Quoting Karl-Heinz Zengerle <ka...@sawag.com>:
> 
> > Hi world.
> >  
> > I see methods to retrieve the formula but I'ld need the results. What
> do
> > I have to do?
> >  
> > Regards,
> > Karl-Heinz Zengerle
> >  
> > 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-user-help@jakarta.apache.org
> 
> 





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


AW: evaluating simple formula

Posted by Karl-Heinz Zengerle <ka...@sawag.com>.
Thanks for the quick answer Avik.

How do I know to which type the formula will result?

Regards,	Karl-Heinz.


-----Ursprüngliche Nachricht-----
Von: avik.sengupta@itellix.com [mailto:avik.sengupta@itellix.com] 
Gesendet: Dienstag, 9. März 2004 00:32
An: POI Users List
Betreff: Re: evaluating simple formula

Call getStringValue or getNumericValue on the cell.

Quoting Karl-Heinz Zengerle <ka...@sawag.com>:

> Hi world.
>  
> I see methods to retrieve the formula but I'ld need the results. What
do
> I have to do?
>  
> Regards,
> Karl-Heinz Zengerle
>  
> 





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


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


Re: evaluating simple formula

Posted by av...@itellix.com.
Call getStringValue or getNumericValue on the cell.

Quoting Karl-Heinz Zengerle <ka...@sawag.com>:

> Hi world.
>  
> I see methods to retrieve the formula but I'ld need the results. What do
> I have to do?
>  
> Regards,
> Karl-Heinz Zengerle
>  
> 





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