Bug 20550

Summary: can't read existing formula cells
Product: POI Reporter: Ethan Shayne <ethanshayne>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: P3    
Version: 2.0-pre3   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: An example of a formula-based cell that I cannot read/access - cell A1

Description Ethan Shayne 2003-06-06 15:20:05 UTC
If I open an existing Excel (2000) workbook, I can't seem to access formula-
based cells at all - HSSFRow.getCell() returns null for any cell that has a 
formula already in it.
Comment 1 Danny Mui 2003-06-06 15:55:04 UTC
When there are merged cells involved, the getCell target may be a little off. 
Please provide sample code/excel files so we can take a look at it.
Comment 2 Ethan Shayne 2003-06-06 17:00:36 UTC
Created attachment 6678 [details]
An example of a formula-based cell that I cannot read/access - cell A1
Comment 3 Ethan Shayne 2003-06-06 17:11:06 UTC
This is the code I am using to access the attached spreadsheet:

FileInputStream inputFile = new FileInputStream("c:\\temp\\test.xls");
POIFSFileSystem fileSystem = new POIFSFileSystem(inputFile);
HSSFWorkbook workbook = new HSSFWorkbook(fileSystem);
HSSFSheet spreadsheet = workbook.getSheetAt(0);
HSSFRow row = spreadsheet.getRow(0);
HSSFCell cell = row.getCell((short)0);

"cell" is coming out null.
Comment 4 Andy Oliver 2003-07-24 16:50:06 UTC
this should work.  We should fix this.
Comment 5 Eric Ladner 2003-07-26 05:03:40 UTC
I can't reproduce this with a recent stock CVS checkout.  I have a quickie
formula test program that reads the attached .xls file fine and produces this:

Formula: <B1+C1>
Raw formula = <B1 C1 + >
Printing cell references:
   (Ref) B1
       (Ref) C1

(the formula is in cell (0,0) on sheet 0.
Comment 6 Avik Sengupta 2003-10-30 17:17:09 UTC
This works, no problems at all.