Workbook containing a pivot table becomes corrupted

The attached file becomes corrupted when just reading and saving it:

	Path workbookPath = Paths.get(getClass().getClassLoader().getResource("pivot-table-file.xlsx").toURI());
Path result = Files.createTempFile(Paths.get("./target"), null, ".xlsx");
Workbook workbook = new Workbook(Files.newInputStream(workbookPath));
workbook.save(Files.newOutputStream(result), workbook.getFileFormat());

pivot-table-file.zip (50.5 KB)

Any ideas or advice whats going wrong?

@adrian.osterwalder,

I did test using our latest version/fix by re-saving the file via Aspose.Cells API. I noticed the output file opens fine into MS Excel 2016 although I found error messages when opening the output file into MS Excel 2007, 2010, etc. Which version of MS Excel you are using? After your confirmation, we will log appropriate ticket for the issue.

@Amjad_Sahi,
Thanks for your reply. Yes, that error message about some file content is exactly the problem. After letting Excel fix them, the pivot tables are gone.
I personally use Microsoft 365 MSO (Version 2202 Build 16.0.14901.20000) 32-bit, but as you said you got the error message in other versions, it seems not to be a problem of a specific version.
I used the Apsose.Cells 21.9 for my tests.

@adrian.osterwalder,

Thanks for providing further details.

We were able to reproduce the issue as you mentioned. We found the output Excel file is corrupted (containing the pivot table) when opening the output file into MS Excel 2007, 2010, 2013, Office 356, etc. The output file opens fine into MS Excel 2016 though.
e.g.
Sample code:

Workbook workbook = new Workbook("f:\\files\\pivot-table-file.xlsx");
workbook.save("f:\\files\\out1.xlsx", workbook.getFileFormat());

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

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

1 Like

Great, thank you

@adrian.osterwalder,

You are welcome.

@adrian.osterwalder,

This is to inform you that your issue has been resolved. We will also include the fix in our upcoming release Aspose.Cells for Java 22.2. Hopefully, the next release will be published in the second week of February 2022.

@Amjad_Sahi,
That are great news. Thank you for the update.

@adrian.osterwalder,

You are welcome.

The issues you have found earlier (filed as CELLSJAVA-44267) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi