poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 16985] New: - Problems with POI-created formula cells
Date Wed, 12 Feb 2003 09:28:57 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16985>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=16985

Problems with POI-created formula cells

           Summary: Problems with POI-created formula cells
           Product: POI
           Version: unspecified
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: HSSF
        AssignedTo: poi-dev@jakarta.apache.org
        ReportedBy: lucabilli@grupposervizi.it


I'm using jakarta-poi-1.9.0-dev-20030122.
If I create a workbook containing formulas and then I try to call 
cell.getNumericCellValue on formula cells, returns 0.0
(the same happens if I save the workbook on disk and then I read it again with 
POI)
If I open such a workbook with Excel2000, it works, but when I try to close the 
document (without any manual change), Excel prompts me with a question: "Do you 
want to save the changes you made to POI.xls? Microsoft Excel recalculates 
formulas when opening files last saved by an earlier version of Excel".
Now, if I say "yes", and I read the newly saved workbook with POI, the 
cell.getNumericCellValue on formula cells returns the correct value.

Here I put a short Java code presenting the problem, then I will attach two 
very simple xls (POI.xls and Excel.xls), the first created with POI and 
containing a formula cell that is not calculated by POI when asked to, the 
latter is the Excel saved version of the same workbook (it is quite bigger than 
the original).

HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sh = wb.createSheet("Sheet");
HSSFRow row = sh.createRow((short) 0);
HSSFCell cell = row.createCell((short) 0);
cell.setCellValue(3.18);
cell = row.createCell((short) 1);
cell.setCellFormula("A1");
//wb.write(new FileOutputStream("POI.xls"));
//wb = new HSSFWorkbook(new FileInputStream("POI.xls"));
//cell = wb.getSheet("Sheet").getRow(0).getCell((short) 1);
System.out.println(cell.getCellFormula());
System.out.println(cell.getNumericCellValue());

This prints out:

A1
0.0

The same happens if you uncomment the three commented lines

By the way, since I know that formulas are under development, today I wanted to 
download the last nightly release before submitting this bug, but I found the 
nightly directory is empty ...

Mime
View raw message