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.
Up arrow icon