poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <deshmol-li...@yahoo.com>
Subject RE: HSSFCell returns numeric value instead of Strings (for numeric strings)
Date Thu, 14 Dec 2006 17:18:05 GMT
Deepak,

Look up the javadocs for HSSFDataFormat.
You could, for instance, test if the dataformat is of
a certain type and convert the numeric value to an
appropriately formatted string.

~ amol

--- "Srivastava, Deepak"
<deepak.srivastava@citigroup.com> wrote:

> Daniel, 
> 
> Thanks for the clarification. 
> Is there any way to take care of non-string value
> when the "number is formatted as string", 
> ie. preserving leading zeros, and avoiding addition
> of decimal digits.
> 
> Thanks,
> Deepak
> 
> -----Original Message-----
> From: Daniel Noll [mailto:daniel@nuix.com]
> Sent: Wednesday, December 13, 2006 11:08 PM
> To: POI Users List
> Subject: Re: HSSFCell returns numeric value instead
> of Strings (for
> numeric strings)
> 
> 
> Srivastava, Deepak wrote:
> > When I read the spreadsheet(cell format as text),
> it has numbers with  like:
> > 100, 10000, 0.967, etc. When I read them using
> POI, I get 100.0, 10000.0, 0.97, etc.
> > 
> > 1. In Excel, I formatted all cells as String for
> the required columns.  
> > 2. In the code it looks like this:  
> <cut>
> > Please advise. I hope this is a well known problem
> and solutions already exists for these. 
> > (A possible work around, or a fix available in new
> version or so).
> 
> It's a misunderstanding.  Merely formatting a number
> as a string does 
> not make it a string.  To actually write a number as
> a string in Excel, 
> you would prefix it with a single quote (')
> character.
> 
> Daniel
> 
> 
> -- 
> Daniel Noll
> 
> Nuix Pty Ltd
> Suite 79, 89 Jones St, Ultimo NSW 2007, Australia   
> Ph: +61 2 9280 0699
> Web: http://nuix.com/                              
> Fax: +61 2 9212 6902
> 
> This message is intended only for the named
> recipient. If you are not
> the intended recipient you are notified that
> disclosing, copying,
> distributing or taking any action in reliance on the
> contents of this
> message or attachment is strictly prohibited.
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> poi-user-unsubscribe@jakarta.apache.org
> Mailing List:    
> http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project: 
> http://jakarta.apache.org/poi/
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> poi-user-unsubscribe@jakarta.apache.org
> Mailing List:    
> http://jakarta.apache.org/site/mail2.html#poi
> The Apache Jakarta Poi Project: 
> http://jakarta.apache.org/poi/
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Mime
View raw message