We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Workbook protection

Hi!

Is it possible to protect/unprotect an excel workbook (only structure and windows without encryption) by using a password?

Thanks!


1 Reply

YG Yavanaarasi G Syncfusion Team May 28, 2008 08:45 AM UTC

Hi Iliya,

Thank you for your interest in Syncfusion products.

Yes. It is possible to protect an excel workbook by using password.

Here is the code snippet:

[C#]
//Protect Workbook.
workbook.Protect(true, true, "syncfusion");

//Unprotect workbook.
// Opening a Existing(Protected) Worksheet from a Workbook
IWorkbook workbook = application.Workbooks.Open(@"ProtectedWorkbook.xls");

//Unprotecting( unlocking) Workbook using the Password
workbook.Unprotect("syncfusion");



Please refer our shipped browser sample that demonstrates the workbook protection:

\\Syncfusion\EssentialStudio\6.2.0.40\Windows\XlsIO.Windows\Samples\2.0\Document Settings\SecuritySettings\WorkBookProtection

Please let em know if you have any other concerns.

Regards,
G.Yavana



Loader.
Live Chat Icon For mobile
Up arrow icon