Free Support Forum - aspose.com

Fail to unprotect xls

using aspose 18.5 ,the dstFile also has password.
try {
com.aspose.cells.LoadOptions loadOptions = new com.aspose.cells.LoadOptions(FileFormatType.EXCEL_97_TO_2003);
loadOptions.setPassword(password);
Workbook workbook = new Workbook(srcFilePath, loadOptions);
workbook.unprotect("");
workbook.save(dstFilePath, FileFormatType.EXCEL_97_TO_2003);
} catch (Exception e) {
//System.out.println(e);
return -1;
}
test.zip (3.8 KB)

@dropin,

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

CELLSJAVA-42666 - Password not removed from EXCEL_97_TO_2003 file using Unprotect

@dropin,

There is an error in your code. This is not the right way to remove password from the encrypted file. Please change the line of code, i.e.,

workbook.unprotect("");

to:

workbook.getSettings().setPassword(null);

Let us know if you still find the issue.

password is removed using workbook.getSettings().setPassword(null);
thanks!

@dropin,

Good to know that your issue is sorted out by the suggested line of code. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.