Worksheet with PivotTables corrupt after save


We have an Excel sheet we are trying to modify with Aspose. Unfortunately the file is corrupt after saving. To see if the problem is caused by our code or the Aspose code, we have written the following sample program:

var inFile = “C:\temp\pivot_in.xlsx”;
var outFile = “C:\temp\pivot_out.xlsx”;

//var lo = new LoadOptions {
// WarningCallback = new WarningCallBack(),
// ParsingFormulaOnOpen = true,
// ParsingPivotCachedRecords = true
var wb = new Workbook(inFile);

//foreach( var s in wb.Worksheets ) {
// foreach( var pt in s.PivotTables ) {
// pt.RefreshDataFlag = true;
// pt.RefreshData();
// pt.CalculateData();
// pt.RefreshDataFlag = false;
// }

wb.Save( outFile, SaveFormat.Xlsx );

When I enable the foreach loop, I receive the following error: Aspose.Cells.CellsException: ‘this data source is not supported.’

When I open the saved file, Excel gives me a warning that the file is corrupted and need to be repaired. After repairing Excel shows the following message: Removed Part: /xl/pivotTables/pivotTable2.xml part with XML error. (PivotTable view) Load error. Line 1, column 0. (874.4 KB)


We were able to observe the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-46995 – Worksheet with PivotTables corrupt after save