Corrupted Excel file after anonymization


I am trying to anonymize a excel document and after, when I open it, excel crashes because the file is broken.
Specifically in my case is the sheet p.46 the, first chart that crashes excel.
I saw with Open XML SDK 2.5 Productivity Tool that it contains a lot of errors. I tried to fix some but there are others that I cannot.

The file before and after are attached in a zip (98.1 KB)
I am using Aspose.Cells



Thank you for your query.

By anonymization if you mean managing the document properties, then you may please visit this link and if you want to encrypt the file, please visit here.

If this information is not helpful to you, please share the sample code which you have used to convert BEFORE.XLSX file to AFTER.XLSX. Also please note that both the files open fine here in Excel 2016.

You may please try this scenario with the latest version Aspose.Cells for .NET 18.7 and share the feedback.

Thank you for your reply.

I also tried with the latest version and I still have the same issue.
And it is a very simple procedure.

Here it is the code:

Workbook workBook = new Workbook(filePath);
this.Anonymize(workBook, replaceString);



We are sorry that the we could not find the definition of this.Anonymize() function. Please share your sample file and code snippet with us for our testing. This sample can be a console application based project which compiles and executes without any exception. We will reproduce the problem and provide our feedback after analysis.

Sorry you are right.

Here it is the complete code:

public override void Anonymize(string filePath, string replaceString)
    Workbook workBook = new Workbook(filePath);
    workBook.BuiltInDocumentProperties.Author = replaceString;
    workBook.BuiltInDocumentProperties.Company = replaceString;
    workBook.BuiltInDocumentProperties.LastSavedBy = replaceString;
    // save back to the original detected format, even if random file name(file upload)
    workBook.Save(filePath, FileFormatUtil.LoadFormatToSaveFormat(FileFormatUtil.DetectFileFormat(filePath).LoadFormat));


Thanks for the sample code.

After an initial test, I am able to observe the issue as you mentioned. I found the output file (after using your sample code with your template file) is corrupted to certain extent. I open the output file into MS Excel (e.g 2007, 2013) manually and click on the sheet “p.46”. Now I use vertical scroll bar to navigate towards first two charts and suddenly it looks like MS Excel crashes which is not responding and I have to restart it.
Sample code:

Workbook workBook = new Workbook("e:\\test2\\before.xlsx"); 
            workBook.BuiltInDocumentProperties.Author = "b"; 
            workBook.BuiltInDocumentProperties.Company = "abc"; 
            workBook.BuiltInDocumentProperties.LastSavedBy = "10-01-2018"; 
            // save back to the original detected format, even if random file name(file upload) 
            workBook.Save("e:\\test2\\out1.xlsx", FileFormatUtil.LoadFormatToSaveFormat(FileFormatUtil.DetectFileFormat("e:\\test2\\before.xlsx").LoadFormat)); 

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

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


Please try our latest version/fix: Aspose.Cells for .NET v18.7.5:

Your issue should be fixed in it.

Let us know your feedback.

Thank you.

But I really need it in nuget if possible and it is not available.



We promise only one release per month. Hot Fixes should not be given to users at all. But for user convenience that they don’t have to wait for one full month, we provide them. If you want to get Aspose.Cells via Nuget, then please wait for our next release expected in next week.

The issues you have found earlier (filed as CELLSNET-46236) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi