Free Support Forum - aspose.com

Chart Data Source / Worksheets.RemoveAt Issue

When creating a workbook from an excel template with a chart on a worksheet which points to a datasource on the same worksheet as the chart, the datasource is changed to another worksheet within the workbook if the worksheets.removeat method is used to remove a worksheet in the workbook.

Steps to duplicate:

Workbook Template has 3 worksheets (“ReportA”, “ReportB”, “ReportC”)

ReportC is in ordinal position 3 and has a chart with the datasource pointing to two cells within ReportC.

ReportB is removed from the workbook using the worksheets.removeat method.

Result:
ReportC’s chart datasource is now pointing to another worksheet within the workbook.

I have narrowed it down to the worksheets.removeat method because if I comment out this line of code, I get the expected results of the chart still pointing to it’s original datasource.

I am at the end of a project and I am not submitting example code and template to demonstrate this issue for the sake of saving time but can do so if needed. I also hate to mention it because I know that every posting here is “PRIORITY” but I am scheduled to have this project completed by Monday, August 1 and this is my last remaining task item. If at all possible, it would be ideal to have the solution before then. Please let me know.

Thank you for your help.

Please try this new version.

The problem is fixed! Thank you for the fast solution!

I spoke too soon. The attachment does not fix the issue. Please help.

If I comment out the single line of code that removes a spreadhseet using the worksheets.removeat method, the charts and graphs populate correctly.