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

Free Support Forum - aspose.com

How to test for password protected Excel files?


I’m converting Excels to PDFs doing the following:

com.aspose.cells.Workbook bookd = new com.aspose.cells.Workbook(fileLoc);


However if the file is password protected I get the following exception:


at java.lang.System.arraycopy(Native Method)

at com.aspose.cells.zsv.a(Unknown Source)

at com.aspose.cells.zsv.a(Unknown Source)

at com.aspose.cells.zsh.a(Unknown Source)

at com.aspose.cells.Workbook.a(Unknown Source)

at com.aspose.cells.Workbook.(Unknown Source)

Is there a way to test to see if the file is password protected ??



Thanks for your query.

Yes, you can determine whether the file is encrypted (password protected), see the document for your reference:
How to Detect a File Format and Check if the File is Encrypted

Hope, this helps a bit.

Thank you.