OWC 11.0 in ASP.NET and C# to create excel file

  • Thread starter Thread starter sreedeeplal
  • Start date Start date
S

sreedeeplal

I'm using OWC 11.0 in ASP.NET and C# to create excel file.

I need to protect/unprotect the sheet by a password. I tried to protect the
sheet by following code.




string Password = "Password123";
object getPasswordFromUser =(object)Password;
xl.ActiveSheet.Protect(ref getPasswordFromUser, ref obj,
ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj, ref obj,
ref obj, ref obj, ref obj, ref obj, ref objTrue, ref obj);But it throws an
exception "Exception from HRESULT: 0xE0040059"

Kindly help me to resolve this issue. Code works well if I miss the password.
 
Back
Top