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

Free Support Forum - aspose.com

Setting open password on attached Excel file causes error in Excel when re-opening

If I set a password on the attached file, when I reopen the file in Excel an error is raised of "Excel found unreadable content… Do you want to recover the contents?"


If I do the same thing in native Excel, there is no issue reopening the file.

Sample code below:

Aspose.Cells.Workbook wkbk = new Aspose.Cells.Workbook(path)
{ Settings = { Password = password } };
<span style=“font-family: “Courier New”;”> wkbk.Save(newFilePath, Aspose.Cells.SaveFormat.Xlsx);

Hi,


Thanks for your posting and using Aspose.Cells.

Please download and use the latest version (links given below). It is working fine.

Please check the output Excel file generated by the following code for your reference. It opens fine in Excel 2016. (Password: 11)

Latest Version Links:
Aspose.Cells for .NET v17.5.7 (.NET 2.0) compiled in .NET Framework 2.0.
Aspose.Cells for .NET v17.5.7 (.NET 4.0) compiled in .NET Framework 4.0.

C#
Aspose.Cells.Workbook wb = new Aspose.Cells.Workbook(“nopassword.xlsx”);
wb.Settings.Password = “11”;

wb.Save(“out.xlsx”, Aspose.Cells.SaveFormat.Xlsx);

Thank you for the quick response. I just tested with 17.5.7.0 and I no longer receive the error.

Hi,


Good to know that your issue is sorted out by the latest version/fix. Feel free to write us back if you have further comments or questions, we will be happy to assist you soon.

Thank you.