You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Khanh Tran <tr...@gmail.com> on 2007/06/28 11:54:50 UTC

Opps! Weird behavior in reading simple formula

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