We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Chart still bounded to first worksheet after copy

Hi all,

This problem was introduced with Aspose.Cells 17.12, it was working on the 17.11 version

I’m copying an entire worksheet into a new one. The original worksheet contains a chart that is bounded to an Excel “Name” created on the worksheet (I’ve created two names: “Series” and “Names”). In the copied worksheet, the chart is still bounded to the first worksheet names, so if I try to change the new names source you can see that nothing change on the chart appearance (see code comments).

I attached a code sample to demonstrate the issue.

AsposeCellsChartsWithNames.zip (50.7 KB)


Thanks for the sample project with template file.

I noticed the behavior using our latest version/fix: Aspose.Cells for .NET v19.11.x. But when I performed the same task in MS Excel manually, I noticed the same behavior, the chart series (in the new sheet) are still referring to first worksheet. You may try to confirm this using the manual way in MS Excel and give us your feedback if you see something different or as per your requirements, let us know with details. Aspose.Cells follows MS Excel standards and specifications when copying sheets with charts, so I do not think this is an issue but expected or correct behavior.

Hi @Amjad_Sahi,

Thanks for your quick response.

We have a customer that is relying on this feature so after the upgrade it is not able to get this working. Will it be possible to add this functionality again? Are you aware of any possible work around to this?

Also that, I tried the same thing in MS Excel and noticed that “names” are removed from the chart series and values but are updated with the corresponding cells in the new worksheet. See image, I simply copy the first sheet on the input.xlsx file in the attached project.

image.png (12.5 KB)
image.png (11.2 KB)


Thanks for the screenshots.

I was able to reproduce the issue as you mentioned by using your sample code with your template file. I found an issue where chart is still bounded to first worksheet after copy operation. Even I tried to use CopyOptions with the updated code segment:
Sample code:

 string inputFileName = "e:\\test2\\Input.xlsx";

            Workbook wb = new Workbook(inputFileName);

            Worksheet firstWorksheet = wb.Worksheets[0];

            var newWorksheet = wb.Worksheets.Insert(1, SheetType.Worksheet);

            CopyOptions options = new CopyOptions();
            options.ReferToDestinationSheet = true;

            newWorksheet.Copy(firstWorksheet, options);

            // change chart source on the new sheet
            var cell = newWorksheet.Cells.GetCell(6, 9);

            // this should change the appearance of the chart on the new sheet, but it is not working
            // because the chart is still referring to the first sheet "name" 
            cell.Value = 12;

            wb.Save("e:\\test2\\out1.xlsx", SaveFormat.Xlsx);

I have logged a ticket with an id “CELLSNET-47051” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

This is to inform you that we have fixed your issue (logged earlier as “CELLSNET-47051”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.


Please try our latest version/fix: Aspose.Cells for .NET v19.11.8 (attached).

Your issue should be fixed in it.

Let us know your feedback.
Aspose.Cells19.11.8 For .Net2_AuthenticodeSigned.Zip (5.0 MB)
Aspose.Cells19.11.8 For .Net4.0.Zip (5.0 MB)

The issues you have found earlier (filed as CELLSNET-47051) have been fixed in Aspose.Cells for .NET v19.12. This message was posted using Bugs notification tool by Amjad_Sahi