We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to set the protection of worksheet

Hi,

May I know how to setup the protection of workbook and a specific worksheet with password?

Thanks!

Dear forbi,

Thanks for your consideration. Currently this feature is not supported.

@forbi,
Aspose.Excel is discarded now which is replaced with a feature-rich high-performance product Aspose.Cells. It provides features to protect worksheets and workbooks. Have a look at the following sample code which demonstrates this feature:

//Specify the template excel file path.
string myPath = @"d:\test\MyBook.xls";
 
//Instantiate a new Workbook.
//Open the excel file.
Workbook workbook = new Workbook(myPath);
 
//Protect the workbook specifying a password with Structure and Windows attributes.
workbook.Protect(ProtectionType.All,"007");
 
//Save As the excel file.
workbook.Save(@"d:\test\MyBook.xls");

For more details go through the following links:
Protecting Worksheets
Protecting and Unprotecting Workbooks

Download the latest version of Aspose.Cells for .NET from the following link:
Aspose.Cells for .NET (Latest Version)

You can download the latest demos here.