I see the IsLocked property. How do I make the worksheet protected?
Please refer to http://www.aspose.com/Products/Aspose.Excel/Guide/Protection.html
. You can use the Worksheet.Protect method or Worksheet.Protection property to protect a worksheet.
@jeljeljel,
Aspose.Excel is discontinued and no more development is done for it here at Aspose. A new product Aspose.Cells is launched which is more efficient and supports all the latest features of MS Excel. A worksheet can be protected using this new product also as shown in the following sample code:
// Creating a file stream containing the Excel file to be opened
FileStream fstream = new FileStream(dataDir + "book1.xls", FileMode.Open);
// Instantiating a Workbook object
// Opening the Excel file through the file stream
Workbook excel = new Workbook(fstream);
// Accessing the first worksheet in the Excel file
Worksheet worksheet = excel.Worksheets[0];
// Protecting the worksheet with a password
worksheet.Protect(ProtectionType.All, "aspose", null);
// Saving the modified Excel file in default format
excel.Save(dataDir + "output.out.xls", SaveFormat.Excel97To2003);
// Closing the file stream to free all resources
fstream.Close();
Here is a detailed article which describes the worksheet protection in detail:
Protecting Worksheets
The latest version of the product can be downloaded here for trials:
Aspose.Cells for .NET (Latest Version)
A runnable solution is available here that can be used to test the variety of features of this new product.