poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Amol Deshmukh <adeshm...@hobsons-us.com>
Subject RE: Getting numeric cells as a formatted string
Date Wed, 28 Sep 2005 21:41:21 GMT
As long as you have restricted your format patterns to something like:
   "($#,##0_);($#,##0)"
ie. have no color information etc., java.text.DecimalFormat should
be able to parse it for you. 

However, if your pattern is slightly more complex, eg. has color 
information like in: 
   "($#,##0_);[Red]($#,##0)"
then you may need to extend java's DecimalFormat to strip out that
information before invoking the super.parse(..) method.

These may help:
http://java.sun.com/j2se/1.4.2/docs/api/java/text/NumberFormat.html

http://jakarta.apache.org/poi/apidocs/org/apache/poi/hssf/usermodel/HSSFData
Format.html


HTH,
~ amol




> -----Original Message-----
> From: news [mailto:news@sea.gmane.org]On Behalf Of Joseph O\\\'Connell
> Sent: Wednesday, September 28, 2005 1:43 PM
> To: poi-user@jakarta.apache.org
> Subject: Re: Getting numeric cells as a formatted string
> 
> 
> 
> I've ran into the same situation - does anyone have a simple solution?
> 
> 
> David Roe <d.roe <at> cyprotex.com> writes:
> 
> > 
> > Is there any way to get the value of a numeric cell as a string,
> > formatted by the cells data format? Or do I have to write a 
> parser that
> > can convert to each data format myself?
> >
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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