poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Khanh Tran" <trancongkh...@gmail.com>
Subject Opps! Weird behavior in reading simple formula
Date Thu, 28 Jun 2007 09:54:50 GMT
I 've opened Excel 2003 and create a simple spreadsheet. I enter =49000 as a
formula for A1 cell.

I then read the cell formula using POI. It returned -16536 instead of 49000.
I also attached the file.

 

What's happen? I don't believe on my eyes!

I am using POI 3.0 final on Windows XP.

 

    HSSFWorkbook workbook = new HSSFWorkbook(new
FileInputStream("c:\\SampleFiles\\simple_formula.xls"));

    HSSFSheet sheet = workbook.getSheetAt(0);

    HSSFRow row = sheet.getRow(0);

    HSSFCell cell = row.getCell((short)0);

    System.out.println("Formula:" + cell.getCellFormula());

 

//Formula:-16536

//will be printed out

// instead of 49000


Mime
View raw message