Free Support Forum - aspose.com

Check excel file is password protected

Hi ,

I am using Aspose.Cell

When i tried to use the below code to check whether the excel file is password protected.
I am not able to use .Open method, because it is saying this methode is absolute.

    Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook();
            workbook.Open(FileName);



            <span style="color:blue;">if</span> (workbook.IsProtected)
            {

                isPassProtected = <span style="color:blue;">true</span>;
            }     <br><br>Can you please help me to get if there is any other methode to check whether it is password protected      <span style="color:green;">      </span></pre>
Hi,

Workbook.Open() is obsoleted, please use Workbook constructor to load the file.
Eg.
Workbook workbook = new Workbook(FileName);
Check the following document on how to load/open Excel files using Aspose.Cells APIs with latest versions:
http://www.aspose.com/docs/display/cellsnet/Opening+Files

To know whether a workbook is protected, please use the following Boolean attribute(s):

Workbook.Settings.IsProtected -- > to check if a workbook is protected

Thank you.

Thank you for your reply.

How can i decript the file

Thank you for your reply.

How can i decript the excel file with password

Hi,
I am using Aspose.Cell version 5.3.0.0

Can you please help me how can i check whether a password protected excel file is checking whether it is password protected and how can i decript that file with password.
I checked all the documents , but i am not getting any idea.

Can you please help me?

One more thing.
If we give

 Aspose.Cells.Workbook wBook = new Aspose.Cells.Workbook(fInfo.FullName);

But that time itself it is throwing error says “Please provide password for the Workbook file.”

Hi,
anishvj:
How can i decrypt the excel file with password
Please see the document:
Encrypting Excel files

anishvj:

If we give
Aspose.Cells.Workbook wBook = new Aspose.Cells.Workbook(fInfo.FullName);

But that time itself it is throwing error says "Please provide password for the Workbook file."

See the sample code on how to open an encrypted file:

Sample code:

//Instantiate LoadOptions
LoadOptions loadOptions = new LoadOptions();

//Specify the password
loadOptions.Password = “007”;

//Create a Workbook object and opening the file from its path
Workbook wb = new Workbook(“e:\test\EncryptedBook.xls”, loadOptions);