Created attachment 29885 [details] Zip file with updated class and Excel sample template Hi all, With version 3.9 (and older versions) it is not possible to rename a sheet which contains some graphs, and it is also not possible to copy graphs while cloning a sheet. I have amended the POI api to support Graph while cloning sheet and also while renaming sheet. Below the solution I have implemented (note that I am not experienced with the POI api, so it might be possible to perform the same operation in a more official way). I hope it will be usefull... Regards, Guillaume
*** Bug 47352 has been marked as a duplicate of this bug. ***
*** Bug 57712 has been marked as a duplicate of this bug. ***
(In reply to Guillaume de GENTILE from comment #0) > Created attachment 29885 [details] > Zip file with updated class and Excel sample template > > Hi all, > > With version 3.9 (and older versions) it is not possible to rename a sheet > which contains some graphs, and it is also not possible to copy graphs while > cloning a sheet. > > I have amended the POI api to support Graph while cloning sheet and also > while renaming sheet. > > Below the solution I have implemented (note that I am not experienced with > the POI api, so it might be possible to perform the same operation in a more > official way). > > I hope it will be usefull... > > Regards, > Guillaume Awesome code~! I'm attempting to copy chart objects from one workbook to another. If I manage to clone both the CTChart and the CTChartSpace objects? Best regards, Novak
(In reply to sebastian.novak from comment #3) > (In reply to Guillaume de GENTILE from comment #0) > > Created attachment 29885 [details] > > Zip file with updated class and Excel sample template > > > > Hi all, > > > > With version 3.9 (and older versions) it is not possible to rename a sheet > > which contains some graphs, and it is also not possible to copy graphs while > > cloning a sheet. > > > > I have amended the POI api to support Graph while cloning sheet and also > > while renaming sheet. > > > > Below the solution I have implemented (note that I am not experienced with > > the POI api, so it might be possible to perform the same operation in a more > > official way). > > > > I hope it will be usefull... > > > > Regards, > > Guillaume > > Awesome code~! > > I'm attempting to copy chart objects from one workbook to another. > If I manage to clone both the CTChart and the CTChartSpace objects? > > Best regards, > Novak Would it be possible if I manage to clone both the CTChart and the CTChartSpace objects? *
Hi there, I have run the sample code of "Guillaume de GENTILE", and I get new sheet create with the data-table at the top but no chart object. I get an Exception: from Method: updateRelationsSheetName In class: class XmlNodeUtils ------------------------------------ while(it.hasNext()) { XSSFChart chart = it.next(); //System.out.println("chart = " + chart); CTChart c = chart.getCTChart(); ERROR HERE: Node node1 = chart.getCTChart().getDomNode(); updateDomDocSheetReference(node1, frwb, oldSheetName); Node node2 = chart.getCTChartSpace().getDomNode(); updateDomDocSheetReference(node2, frwb, oldSheetName); } continue; ------------------------------------ Note that the variable/object : c , is not used in the code: "CTChart c = chart.getCTChart();" Hope Guillaume can debug this. Regards, P
Hi all, I have adapted the code to make it compatible with POI 3.12. (consider New ZIP) With the enclosed path it is possible to rename a Sheet containing a Chart (the Chart referencees will be correctly refreshed). Also it is possible to duplicate a Sheet containing charts. Note that due to a bug in the Apache POI, it is not possible to Clone and rename a Sheet in the same context. The workbook must be closed and reopenned. See testcase "TestCloneSheet.java" for more details. Regards, Guillaume de GENTILE
Created attachment 32753 [details] New patch for POI 3.12 New patch for POI 3.12: * Rename Sheet with Chart works fine :) * Clone Sheet with Chart works fine :) Regards, Guillaume de GENTILE
*** Bug 49319 has been marked as a duplicate of this bug. ***
The provided patch has been integrated into version 4.1.1 with a correction to be released in version 5.0.1 in response to bug https://bz.apache.org/bugzilla/show_bug.cgi?id=63902