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

Free Support Forum - aspose.com

Copying worksheet - Chart error bars custom values does not refer to new worksheet

Hi,

I am using a Excel template with a column chart, referring to cell ranges within the document. I wish to copy this worksheet, which is working fine, with one notable exception. The chart also displays Error Bar charts (Click on chart -> “Chart Elements” -> Errors bars -> More options -> Custom -> Specify value). In the original worksheet the positive and negative value may refer to for instance “=‘originalSheetname’!$AC$4:$AC$18”.

Excel behavior
If I open Excel and opt to manually copy this sheet in Excel; the newly created sheet containing this chart till refer to the new sheetname, e.g. “=‘newSheetname’!$AC$4:$AC$18”, including the error bar custom values. Everything works as expected.

Aspose.Cells copy behavior
However, if I use the copy function i Aspose.Cells .NET - the custom error bars values will always refer back to the original sheet. Everything else in the chart appear to reference the values in the newly copied chart. This behavior appear to impact specifically error bar charts in a Column Chart. I.e the result from doing the same operation manually by copying a sheet in Excel, compared to Aspose.Cells, appear to differ - even if using the CopyOptions. Note that the actual cell/data references in the column chart refers to the correct cells in the newly created (copied) worksheet.

The issues is the same whether I use WorkBoook.Copy or workbook.Worksheets[workbook.Worksheets.Add()] with destination.Cells.CopyRows with the relevant CopyOption (or without) i.e setting options.ReferToDestinationSheet = true.

Aspose Cells .NET. Version: 17.9.0.0

Could you please advise how to proceed replicating the Excel behavior if the error bar custom values handling in Aspose.Cells? I.e getting the error bars customer value ranges (positive and negative) to refer to the newly created/copied to worksheet.

Thank you.

@anders.swe8fb2c

Thanks for using Aspose APIs.

Please provide us your sample Excel, you can create it manually using Microsoft Excel as well. Besides that, please provide these Excel files

1 - Microsoft Excel generated Expected Output Excel file.
2 - Aspose.Cells generated Output Excel file.

Please share screenshot(s) as well that explain your issue clearly. Please also provide the sample code that you are using. These things will help us look into your issue and replicate it and we will be able to provide you a fix or workaround to solve it. Thanks for your cooperation in this regard and have a good day.