I’m having problems when copying a worksheet from one workbook to another workbook.
If I copy the worksheet a second time into the new workbook, the chart uses the data from the first worksheet.
I found this post which describes a problem similar to the one I’m having but on the .NET version of Aspose Cells:
I am attaching an archive in which there is an example file as well as the result obtained with the following code:
Please notice, I am able to reproduce the issue as you mentioned by using your template file. I found chart is bounded to first worksheet when copying a worksheet second time from one workbook to another workbook. I noticed in the “Test_2” worksheet, the chart data points to the “Test_1” instead of “Test_2”. Moreover, I also find the print area is not correctly defined in the “Test_2” tab, while it is correct in the “Test_1” tab. I have logged a ticket with an id “CELLSJAVA-44550” for your issue. We will look into it soon.
Once we have an update on it, we will let you know.
I tested with the code from your comment and it works perfectly.
Although this code solves my problem, I would like to know for my information if you consider that this operation is normal or if it is still an anomaly that you will correct in a future version?
Thanks in advance for your feedback, have a great day.
Good to know that the updated code segment works fine now.
And, this is normal/expected behavior and we will not fix this issue in the APIs. You only need to instantiate and use new CopyOptions (with relevant “ReferToDestinationSheet” option on) everytime for each copy operation.