Checking presence of password

Hi,

Has Aspose.Cells for .NET any way to uniquely identify the presence of a password for read the file?

I found two ways, but they have ambiguous results.
1. ExceptionType.InvalidData (CellsException e.Code) - is it only for password?
2. Error message contains ‘password’ - can it be changed (for example, by localization)?

Best regards,
Alex Shloma

Hi Alex,


In Aspose.Cells for .NET API, we have specific properties for your need. Please check the WorkbookSettings Class for IsProtected and IsWriteProtected members.

Feel free to write back.
Thank you.

Hi Babar Raza,

Thank you for so quick response, but I meant a password to open (read) the workbook (exception in Workbook constructor).

Thanks,
Alex Shloma

Hi Alex,


Can you share such file? We will look into it to provide you further guidance. Thank you

Please see attached file (password: qwerty).

But it is common Excel file. What I want to ask you is how can I determine that Workbook is password protected if I get only CellException with text “Please provide password for the Workbook file.”. For example Aspose.Words has IncorrectPasswordException and I can uniquely identify this. In Aspose.Cell I get only CellException in the similar situation.

Thanks,
Alex Shloma

Hi Alex,


Thank you for the elaboration and the sample file.
As you have mentioned, right now we can only identify that the Workbook is password protected by the Exception Message "Please provide password for the Workbook file."

For your need, we can log in your Database as an Enhancement to add some specific code for this purpose. Please acknowledge us in this regard.

Thank you

Hi Babar Raza,

For me will be better if you will send me sample in zip.

Thanks,
Alex Shloma

Hi,

We can change the CellsException.Code as ExceptionType.IncorrectPassword.

Let us know if it fits your need.

Hi Shakeel Faiz,

Yes, it will be great.

Many thanks,
Alex Shloma

Hi Alex,

We have implemented your requirement in our latest fix version of Aspose.Cells for .NET v6.0.0.1. Please feed us back on this.

Reference:
Aspose.Cells.CellsException.Code as Aspose.Cells.ExceptionType.IncorrectPassword

Hi Babar Raza,

All works fine now. I so appreciate your help.
Thank you guys!

Best regards,
Alex Shloma

The issues you have found earlier (filed as 28590) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.