Hi there, I am trying to create a report in Excel using POI. I read an Excel file as a template which also contins formulaes. Then I have to create around 15 Sheets dynamically for the report, in the same workbook. I create the first sheet successfully, and for the next on, I simply clone the first one. I found that if the template (and hence first sheet) draws the chart correctly. And for the cloned sheets, it clones the chart as it is, means it just places the same view on all the sheets. The reason is that, the value range and series still referes to the first sheet, and does not dynamically update the sheet reference. I think this should be a small bug where the sheet name is not provided dynamically to the chart values.. Cheers - Amol Athavale
Try the latest POI-3.5-beta4. If the problem persists, re-open this bug and attach the problem file and sample code to reproduce the problem. Yegor
I am suffering the same problem with POI-3.5beta5. It is just a template sheet with data, a chart based on the data. Cloning the sheet doesn't copy the chart or the data reference in the copied chart is still pointing to the first sheet(template).
*** Bug 27075 has been marked as a duplicate of this bug. ***
Created attachment 33226 [details] Output of copying a chart This appears to be fixed in POI 3.13. In Jython: > wb = WorkbookFactory.create(File('test-data/spreadsheet/SimpleChart.xls')) > wb.cloneSheet(0) > fos = FileOutputStream('test-data/spreadsheet/SimpleChart-copiedChart.xls') > wb.write(fos) > fos.close() Opening the SimpleChart-copiedChart.xls workbook, I can verify that the chart from Sheet1 was copied to Sheet4. Marking as FIXED.
Added unit test in r1710730 under scratchpad (main POI doesn't have high-level API to get a list of chart objects on a sheet).