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

Free Support Forum - aspose.com

Aspose.cells Chart looses formatting

I am using Aspose.Cells version.

I have an Excel file with pivot chart. All I am doing is opening the file and saving as a new file.
It is not preserving formatting on the file.

When I add below lines, it formattes it totally differently.

Please see attached input file (template) and two outputs

Workbook wb = new Workbook(sTemplate);
String sOutputFileName = “Output_no_calculate.xls”;

Aspose.Cells.Charts.ChartCollection chartCollection = sheet.Charts;

if (chartCollection != null && chartCollection.Count > 0)
foreach (Aspose.Cells.Charts.Chart chart in chartCollection)
chart.Calculate(); // tried with and without this.

wb.Save(sOutputFolder + @"" + sOutputFileName, SaveFormat.Excel97To2003);


Thanks for providing us template file and sample code.

After an initial test, I observed the issue as you mentioned by using your sample code with your template XLSX file. I found that chart (in the first worksheet) looses formatting in XLSX to XLS rendering. When we call Chart.Calculate() method before saving to XLS file format, it formats differently though.
Sample code:

Workbook wb = new Workbook(“e:\test2\RollingVaRReport-template.xlsx”);
wb.Save(“e:\test2\out1.xls”, SaveFormat.Excel97To2003);

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

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

Thank you.

thanks for your quick response. I am now saving in same format and the issue doesnt happen. So I am good for now.


Yes, sure, you may save the template file in the same format (XLSX) as a workaround for the time being and we will try to figure your issue out for XLS file format from XLSX soon.

Thank you.


Well, we have evaluated your issue further. I’m afraid converting XLSX to XLS is not supported well by the component at the moment. Some
formatting and settings will not be same as source file. If you think the
result with calculate() is fine (or provide details for differences when calling Chart.Calculate() method), we might provide you a fix that could call chart.Calculate() method automatically before converting XLSX to XLS in Workbook.Save() method.

Thank you.