Aspose fails to open proteced Workbooks


#1

Hi Laurence,

Contrary to what you have posted, we have found that Aspose fails to read an Excel file if the Workbook and the first worksheet in the workbook are protected.

If the Workbook is protected, the error message thrown is:

"Currently, Worksheets protected by password is not supported."

If the workbook is unprotected but the first worksheet is protected we get this:

"Erros in Excel Open method."

We have cross-checked the issue with all the releases of Aspose.Excel starting from 1.7.3.2 to 1.7.7.0 and this disgusting bug exists.

Can you please do something quickly. We are scheduled to go for a production deployment next week.

Thanks & Regards,

Partha


#2

Dear Partha,

Sorry for the problem. Please send me your design Excel file and I will fix it ASAP.


#3

Hi Laurence,

Thanks for your prompt response.

We have checked out the fix 1.7.8. If the Workbook is unprotected and the sheets are protected it works fine now. But the issue of opening protected Workbook remains.

The excel workbooks we use are sent to users who should not be able to modify the workbook structure and hence needs to be protected.

Can you please do something?

Thanks & Regards,

Partha


#4

Dear Partha,

Unfortunately I cannot provide a quick fix to solve this Workbook protection issue.
When the workbook is protected, the excel file is internally encrypted. So there are some jobs to do to find the encryption/decryption method. I will work on this issue.

Maybe you can try this approach. Since you embedded VBA in your file, could you use VBA to protect your workbook when the file is opened?

I tried the following method and it worked fine.

I created a file and didn’t protect the workbook with password. In VBA project, I added the following code.

Private Sub Workbook_Open()
ActiveWorkbook.Protect Password:="abcdef"
End Sub

If needed, you can also protect VBA project with password.


#5

Thanks for you help Laurence. I think that is a workable solution.


#6

While this workaround may suffice for some scenarios, it does not address scenarios where the workbook must be locked down. The workaround provided allows the user opening the workbook to choose to disable the macro, thus leaving the workbook unprotected.

Unfortunately, my use of the Aspose.Excel product currently depends on being able to open protected workbooks. I cannot allow the worokbooks to be unprotected when opened by editors

I am evaluating the product and I consider this to be a showstopper.Crying



#7

There are two level of protection for an Excel file:

1. File protection
In this mode, if you don't have a password, you cannot open this file. In this thread before, I talked with Partha about this issue.

2. Workbook/Worksheet protection
In this mode, you don't need a password to open a file. But if you want to change the content or structure of this file, you should provide a password.
Aspose.Excel supports to import a file with such protection. And the created file cannot be unprotected when opened by users. Aspose.Excel also supports to protect worksheet at run time.

Please write a simple case to test it:

Excel excel = new Excel();
excel.Open(myFile); //File with protection
excel.Save("C:\\book1.xls");

Then you can open and check the result file.