I typed only 987.01 and 987.02 in. There is no round problem.

-----Urspr�ngliche Nachricht-----
Von: Graaf, Edgar de (fin) [mailto:[EMAIL PROTECTED]]
Gesendet: Donnerstag, 18. April 2002 11:50
An: '[EMAIL PROTECTED]'
Betreff: RE: Wrong result from numberic cell value with
v1.5.0-dev-2002041 6


Isn't because Excel show two decimals but it stores the full number. If you
use the round function to round it to a certain amount of decimals?

-----Oorspronkelijk bericht-----
Van: Teutscher, Uwe [mailto:[EMAIL PROTECTED]]
Verzonden: donderdag 18 april 2002 11:21
Aan: '[EMAIL PROTECTED]'
Onderwerp: Wrong result from numberic cell value with
v1.5.0-dev-20020416


Hi

I have the following problem with POI versions
jakarta-poi-1.5.0-dev-20020416-bin and version 1.4583.

I get the wrong result back when I read a cell with the vale 987.01.


public class Test {
    public static void main(String[] args)  throws IOException {

        POIFSFileSystem fs = new POIFSFileSystem(new
FileInputStream("test.xls"));
        HSSFWorkbook wb = new HSSFWorkbook(fs);
        HSSFSheet sheet = wb.getSheetAt(0);
        HSSFRow row = sheet.getRow(0);

        HSSFCell cell = row.getCell((short)0);
        System.out.println("> " + cell.getNumericCellValue());
        cell = row.getCell((short)1);
        System.out.println("> " + cell.getNumericCellValue());
        cell = row.getCell((short)2);
        System.out.println("> " + cell.getNumericCellValue());
        cell = row.getCell((short)3);
        System.out.println("> " + cell.getNumericCellValue());
    }
}

The excel file test.xls has one row with 4 cells:
987.0           987.01          987.02          987.011         


The result is:
987.0
987.010625
987.020625
987.011

Thanks for your help

Reply via email to