Bug 26862 - Clone Sheet with Charts...
Summary: Clone Sheet with Charts...
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: unspecified
Hardware: Other other
: P3 enhancement with 1 vote (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
: 27075 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-02-11 15:33 UTC by Amol Athavale
Modified: 2015-10-27 07:46 UTC (History)
1 user (show)



Attachments
Output of copying a chart (10.50 KB, application/vnd.ms-excel)
2015-10-27 06:17 UTC, Javen O'Neal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Amol Athavale 2004-02-11 15:33:54 UTC
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
Comment 1 Yegor Kozlov 2008-12-29 09:28:29 UTC
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
Comment 2 Bart De Tandt 2009-06-11 02:31:30 UTC
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).
Comment 3 Dominik Stadler 2013-08-04 19:04:41 UTC
*** Bug 27075 has been marked as a duplicate of this bug. ***
Comment 4 Javen O'Neal 2015-10-27 06:17:01 UTC
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.
Comment 5 Javen O'Neal 2015-10-27 07:46:57 UTC
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).