poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Ladner <elad...@goldinc.com>
Subject Re: getStyle()getDataFormat && NumberFormatter Question
Date Sun, 25 Jan 2004 04:24:30 GMT
This will probably do the trick.

NumberFormat percent = NumberFormat.getPercentInstance();


On Fri, 2004-01-23 at 08:31, illyushyn@dev.kck.ru wrote:
> Hello all.
> I'm new in POI, so sorry for maybe a silly question.
> I'm using HSSF API to read xls files and to construct my objects.
> But I don't know how to manage cell formatting which is used in Excell.
> For example:
> I have a cell value in Excel -  "95%" this is a numeric field with 
> "percent formatting".
> When I apply cell.getNumericCellValue() I receive 0.95. I guess it's OK.
> Then I use cell.getCellStyle().getDataFormat() and receive "0%" which is 
> also OK.
> But I didn't find how to receive a result(in String format, maybe) with 
> value "95%".
> Is there any way in POI to construct such a string having value(0.95) and 
> dataType(0%)???
> I've found 2 NumberFormatter classes, but I don't know how to use them, 
> the is absolutely no documentation
> and while tryng NumberFormatter,format(99,1) I receive an error : 99 index 
> out of bounds.
> Thanks in advance.
Eric Ladner <eladner@goldinc.com>

View raw message