I believe  0.27990000000000004 is how excel stores the value 27.99%.  It
looks correct to me, so if you want the value to read 27.99 just
multiply it by 100 to get the percentage 27.99.  

-Levi

-----Original Message-----
From: becomp_2002 [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 23, 2007 8:45 AM
To: poi-user@jakarta.apache.org
Subject: Retrieving numeric value using apache poi

Hi,

When I read a numeric cell of my excel sheet using apache poi, it
returns wrong double value as described below.

The cell has value = 27.99%
when I read this cell value using apache poi it gives me
0.27990000000000004

for (short inxColumn = 0; inxColumn <
getColumnCount(); inxColumn++) {
        // Add each cell to the row
        iCellType = row.getCell(inxColumn).getCellType();
        System.out.println("iCellType = " + iCellType);

        switch (iCellType) {
                case HSSFCell.CELL_TYPE_NUMERIC :
                        double d =
row.getCell(inxColumn).getNumericCellValue();
                
System.out.println("row.getCell(inxColumn).getNumericCellValue()
= "+d);
                        break;
                .
                .
                .
                .
                .
                .
                .
        }
}

I need the value as 27.99

Can anyone please tell what could be wrong?

Thanks


      Office firewalls, cyber cafes, college labs, don't allow you to
download CHAT? Click here:
http://in.messenger.yahoo.com/webmessengerpromo.php

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


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

Reply via email to