Free Support Forum -

Issue with Excel Encryption


We are using Aspose Cells for encrypting Excel files.

Previously we were using this call (which was working properly):

workbook.protect(ProtectionType.OPEN_FILE, password);

We upgraded jars and switched to this call since OPEN_FILE was no longer available (which is not working):

workbook.protect(ProtectionType.CONTENTS, password);

We need to protect our excel workbooks when they are opened. Is there an equivalent API for the newer jar files?

Thanks in advance!


Thanks for your posting and using Aspose.Cells for Java.

Please use the following code to password protect your file. When you will open the output file, Ms-Excel will prompt you to enter password. It will open file if you will enter correct password.


Workbook workbook = new Workbook();



Moreover, we recommend you to kindly see the document for your reference:

Thank you.