Bug 35084 - Formula not cloned using cloneSheet
Summary: Formula not cloned using cloneSheet
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.0-dev
Hardware: PC Windows 2000
: P2 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2005-05-26 12:34 UTC by Stefano Rocca
Modified: 2005-05-31 13:03 UTC (History)
0 users

Sample Excel file (6.50 KB, application/octet-stream)
2005-05-26 12:36 UTC, Stefano Rocca

Note You need to log in before you can comment on or make changes to this bug.
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

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 :)