Free Support Forum - aspose.com

Issue with Excel Encryption

Hi,

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!

Hi,

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.

Java


Workbook workbook = new Workbook();


workbook.getSettings().setPassword(“123”);


workbook.save(“output.xlsx”);

Hi,


Moreover, we recommend you to kindly see the document for your reference:
http://www.aspose.com/docs/display/cellsjava/Encrypting+Files

Thank you.