Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Mon Sep 19, 2011 5:01 pm

Hi,

We're using a trial version of your product & hope to purchase in the next couple of weeks. I've run into an issue with a password protected .xls file. I keep getting this message when I try to load the file (LoadFromFile):

System.ArgumentOutOfRangeException: Wrong password.
Parameter name: password

I know the password, is there a way to provide it to the LoadFromFile method so we can open it or, better yet, disable it?

ahoward
 
Posts: 4
Joined: Thu Aug 18, 2011 3:07 pm

Tue Sep 20, 2011 3:18 am

Sorry for any inconvenience caused by us.

If you want to load an encrypted file, you can use the OpenPassword attribute we provide.
E.G:
Code: Select all
            Workbook workbook = new Workbook();
            workbook.OpenPassword = "iceblue";
            workbook.LoadFromFile(@"..\..\Protect.xlsx");
            Worksheet worksheet=workbook.Worksheets[0];
            //decryp the file with the password
            worksheet.Range["B1"].Text = "Open successfully";
            workbook.SaveToFile("Sample2.xlsx");
            System.Diagnostics.Process.Start(workbook.FileName);

The Protect.xlsx had already encrypted by the password iceblue, you can have a try. If you still have any questions, please contact us.
Tina
Technical Support/Developer,
e-iceblue Support Team
User avatar

Tina.Lin
 
Posts: 152
Joined: Tue Sep 13, 2011 5:37 am

Tue Sep 20, 2011 5:54 pm

We are using the OpenPassword method and are still getting an error about it being the wrong password. Is this software compatible with Office 2007? Are there different instructions for the different versions of Office?

Thanks,
Allison

ahoward
 
Posts: 4
Joined: Thu Aug 18, 2011 3:07 pm

Wed Sep 21, 2011 2:55 am

Sorry for any inconvenience caused by us and thank you for your patience with our reply

Our softwares are compatible with office 2007, I have tested the demo successfully and there are no problems. I will give you the demo by attachment. The password of the Excel is iceblue. You can have a try. And the version of Spire.xls we use is the latest. You can download it from the address http://www.e-iceblue.com/Download/downl ... t-now.html
If there are any other questions, would you please send us your xls file to help us reproduce the problem.
Attachments
LoadProtectionFile(9-20).zip
(9.52 KiB) Downloaded 562 times
Tina
Technical Support/Developer,
e-iceblue Support Team
User avatar

Tina.Lin
 
Posts: 152
Joined: Tue Sep 13, 2011 5:37 am

Wed Sep 21, 2011 7:40 pm

I've tried to attach the file I'm working with, but your system is telling me you only allow 256 KiB. My zip file is 279KB. I'm using OpenPassword with the correct password and it won't open the file. I get the exception:

Wrong password. Parameter name: password

The password for the file is 'testing'.

This is my code (I've verified that it is passing the correct password):

Dim ef As Workbook = New Workbook()
If _utilities.GetEquipmentSheetPassword() <> "" Then
ef.OpenPassword = _utilities.GetEquipmentSheetPassword()
End If
ef.LoadFromFile(ExcelFileName)

It can read files that don't have a password, but it's failing every time for files that do have the password. We really need to get this working asap. Like I said, we bought a license already, so I could really use your full attention on this matter.

Please let me know how I can get the file to you for testing.

Thanks!
Allison

ahoward
 
Posts: 4
Joined: Thu Aug 18, 2011 3:07 pm

Thu Sep 22, 2011 1:38 am

Thank you for your patience for reply.

Would you please send your Excel file and password to the tina.lin@e-iceblue.com? I will keep track of your question.
Tina
Technical Support/Developer,
e-iceblue Support Team
User avatar

Tina.Lin
 
Posts: 152
Joined: Tue Sep 13, 2011 5:37 am

Thu Sep 22, 2011 6:40 pm

Tina, I sent you the file this morning. Please let me know what you find. Thanks!

ahoward
 
Posts: 4
Joined: Thu Aug 18, 2011 3:07 pm

Fri Sep 23, 2011 2:45 am

hello,ahoward

Sorry for any inconveniences caused by us
I have Received the file you sended,and there no problems when running on my environment.
I have send the demo to your Email. You can have a try. If you still have any problems, please contact us.
Tina
Technical Support/Developer,
e-iceblue Support Team
User avatar

Tina.Lin
 
Posts: 152
Joined: Tue Sep 13, 2011 5:37 am

Sat Apr 13, 2013 12:14 am

Hi,

Sorry to raise an old thread, but I can only unlock xlsx files, not xls. I'm using the demo code and the protect.xls file, and am running version 7.0 of Spire.XLS.

Any ideas?

dev.rdniehaus
 
Posts: 1
Joined: Fri Apr 12, 2013 11:29 pm

Mon Apr 15, 2013 3:21 am

Hi rdniehaus,

Regarding to the issue, it needs to use the SaveToFile(string fileName, ExcelVersion version) method, please refer to the code as below:

Code: Select all
workbook.SaveToFile("Sample2.xlsx",ExcelVersion.Version2010);
//workbook.SaveToFile("Sample2.xlsx",ExcelVersion.Version2007);


If there are any questions, welcome to get it back to us.

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Wed Apr 17, 2013 8:42 am

Hi rdniehaus,

Have the issue been resolved? Does the code work well for you? Could you please update the thread if convenience?

Thanks,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Mon Apr 22, 2013 9:03 am

Hi rdniehaus,

Have your issue been resolved? Could you please update the thread if convenience?

If there are any questions, welcome to get it back to us.

Thanks,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Tue Oct 04, 2016 8:33 am

Hi,

I thought I'd tag on the end of this. How do I not protect the saved Excel file? My issue is writing the Excel file. I've opened a password protected file with:

Code: Select all
Workbook workbook = new Workbook();
workbook.OpenPassword = "password";
workbook.LoadFromFile(templateFile.FullName);


However the resulting file I save is also protected. I do not want the saved file to be password protected. I tried this:

Code: Select all
// save Excel
workbook.OpenPassword = "";
workbook.SaveToFile(targetFile);


Guidance welcome.

Thanks,
Steve

stExceL
 
Posts: 8
Joined: Tue Mar 24, 2015 4:46 pm

Tue Oct 04, 2016 10:16 am

Hello,

Thanks for your inquiry. Please use the following method to remove the password of the file.
Code: Select all
Workbook.UnProtect();


Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Sun Oct 09, 2016 8:16 am

Hello,

Has the issue been resolved? Could you please give us some feedback at your convenience?

Thanks,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Return to Spire.XLS