You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by "zacbol at cfi2.com" <za...@host.wstcom.net> on 2003/11/25 23:35:29 UTC

Retrieving bool from an HSSFCell of type CELL_FORMULA


I'm working with HSSF to read Excel data into my own data structure, using the 
high level API (hssf.usermodel).  There seems, however, to be a problem calling 
HSSFCell.getBooleanCellValue() for cells of type CELL_FORMULA.  Rather than 
reading the data, an exception is thrown.  In contrast, 
HSSFCell.getStringCellValue() and HSSFCell.getNumericCellValue() work fine in 
this context.  Further, HSSFCell.getBooleanCellValue() works correctly for 
cells of type CELL_BOOLEAN.  

The following seems to indicate that this issue has been resolved:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13078

Is it simply the case that this fix applies only to the event API and these 
changes have not propagated to the high-level API?  Are there workarounds that 
avoid having to reimplement the existing code using the Event API or fixing the 
POI sourcecode(if this really is a bug)?

Thanks.
-Zac


  



----- End forwarded message -----




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


Re: Retrieving bool from an HSSFCell of type CELL_FORMULA

Posted by Avik Sengupta <av...@itellix.com>.
Sorry, this functionality is currently missing. Bug 13078 talks about
using boolean values (ie, the literals TRUE/FALSE) as parts of a
formula. ie, things like IF(TRUE,......) etc. 

What you want are boolean "return" values, which are stored in a
different way from what 13078 talks about. 

I hesitate to call it such, but one workaround is to
getNumericCellValue(), consider that number as an 8 byte (littleendian)
IEEE format. The third byte is then the boolean value you require. ..
phew

It should be simpler to add this functinality.. you need to change
records/FormulaRecord. If someone is willing to do it, i am happy to
help with the specs. 

Regards
-
Avik


On Wed, 2003-11-26 at 04:05, zacbol at cfi2.com wrote:
> I'm working with HSSF to read Excel data into my own data structure, using the 
> high level API (hssf.usermodel).  There seems, however, to be a problem calling 
> HSSFCell.getBooleanCellValue() for cells of type CELL_FORMULA.  Rather than 
> reading the data, an exception is thrown.  In contrast, 
> HSSFCell.getStringCellValue() and HSSFCell.getNumericCellValue() work fine in 
> this context.  Further, HSSFCell.getBooleanCellValue() works correctly for 
> cells of type CELL_BOOLEAN.  
> 
> The following seems to indicate that this issue has been resolved:
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13078
> 
> Is it simply the case that this fix applies only to the event API and these 
> changes have not propagated to the high-level API?  Are there workarounds that 
> avoid having to reimplement the existing code using the Event API or fixing the 
> POI sourcecode(if this really is a bug)?
> 
> Thanks.
> -Zac
> 
> 
>   
> 
> 
> 
> ----- End forwarded message -----
> 
> 
> 
> 
> - ---------------------------------------------------------------------
> 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: Retrieving bool from an HSSFCell of type CELL_FORMULA

Posted by "karl-heinz (SAW)" <ka...@sawag.com>.
Hi Zac.

A boolean value is an atomic value and not a formula. When a formula
shall return a Boolean value (when it's evaluated) you can't apply a
function which shall fetch a Boolean value.

Yours sincerely,
Karl-Heinz Zengerle
___________________________________________________
 More than competence in Document Management 
___________________________________________________
SAW AG
Waldmünchenerstr. 12
81549 München
Tel.: ++49-89-68088368
Fax: ++49-89-68088389
www.sawag.com

___________________________________________________

-----Ursprüngliche Nachricht-----
Von: zacbol at cfi2.com [mailto:zacbol@host.wstcom.net] 
Gesendet: Dienstag, 25. November 2003 23:35
An: poi-user@jakarta.apache.org
Betreff: Retrieving bool from an HSSFCell of type CELL_FORMULA



I'm working with HSSF to read Excel data into my own data structure,
using the 
high level API (hssf.usermodel).  There seems, however, to be a problem
calling 
HSSFCell.getBooleanCellValue() for cells of type CELL_FORMULA.  Rather
than 
reading the data, an exception is thrown.  In contrast, 
HSSFCell.getStringCellValue() and HSSFCell.getNumericCellValue() work
fine in 
this context.  Further, HSSFCell.getBooleanCellValue() works correctly
for 
cells of type CELL_BOOLEAN.  

The following seems to indicate that this issue has been resolved:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=13078

Is it simply the case that this fix applies only to the event API and
these 
changes have not propagated to the high-level API?  Are there
workarounds that 
avoid having to reimplement the existing code using the Event API or
fixing the 
POI sourcecode(if this really is a bug)?

Thanks.
-Zac


  



----- End forwarded message -----




---------------------------------------------------------------------
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