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.

Fri May 19, 2017 9:30 pm

Hello, i want ask something. I don't know why, but it's happening in my program.
I have an excel file that already protected before with spire protect function with some password. But when i wanna open it again and remove the password(the protection excel), i always have this message or error in my C# (look at the picture). I use the newest spire.xls version. Can you help me please to solve my problem. This is my syntax :
Code: Select all
dbItem.OpenPassword = "123456789";
            dbItem.LoadFromFile(@"..\..\Data\dbItem.xls");
            dbItem.UnProtect();
            dbItem.Protect("");

Image
Sorry for my bad english...

AlClar1ty
 
Posts: 3
Joined: Wed Apr 12, 2017 1:32 am

Mon May 22, 2017 3:19 am

Hello,

Thanks for your inquriy. Please kindly note that the protect method doesn't support passing the empty string but null, and there are two methods you could use.
Code: Select all
dbItem.OpenPassword = "123456789";
dbItem.LoadFromFile(@"..\..\Data\dbItem.xls");
dbItem.UnProtect();

or
Code: Select all
dbItem.OpenPassword = "123456789";
dbItem.LoadFromFile(@"..\..\Data\dbItem.xls");
dbItem.Protect(null);

If the issue still exists, please share the document you were using here or send it to us(support@e-iceblue.com) via email.

Sincerely,
Gary
E-iceblue support team
User avatar

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

Return to Spire.XLS