Bug 35084

Summary: Formula not cloned using cloneSheet
Product: POI Reporter: Stefano Rocca <s.rocca>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: critical    
Priority: P2    
Version: 3.0-dev   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Attachments: Sample Excel file

Description Stefano Rocca 2005-05-26 12:34:50 UTC
If I clone a sheet and try to get a cell that should contain a formula, I get a
null.

I'm using the latest CVS version (I needed DrawingRecord.clone() method).

Sample code:

FileInputStream fis = new FileInputStream("bug.xls");
HSSFWorkbook wb = HSSFWorkbook(fis);
HSSFSheet s = wb.cloneSheet(0);
HSSFRow r = s.getRow(0);
HSSFCell c = r.getCell((short)0);
return c; // returns null
Comment 1 Stefano Rocca 2005-05-26 12:36:30 UTC
Created attachment 15176 [details]
Sample Excel file
Comment 2 Avik Sengupta 2005-05-31 20:27:45 UTC
strange, this is true. Even though both FormulaRecord and FormulaRecordAggregate
implement apparently correct clone() method!

Testcase added to TestUnfixedBugs. Fix TODO. 
Comment 3 Avik Sengupta 2005-05-31 21:03:42 UTC
Fixed. FormulaRecordAggregates are wrapped in ValueRecordAggregates, which
Sheet.clone() did not consider. Thanks for the bug report. 

Please verify.

Testcase removed to TestHSSFSheet :)