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

Free Support Forum - aspose.com

How to protect the cell content of worksheet

Hi,

may I know how to protect the cell content in worksheek?

Please refer to http://www.aspose.com/Products/Aspose.Excel/Api/Aspose.Excel.Worksheet.Protect.html. You can use Worksheet.Protect method.

@forbi,
Aspose.Cells has replaced the old product Aspose.Excel. This new product supports all the latest features of MS Excel including protection of worksheets. You can use this feature as demonstrated below:

// 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(); 

A detailed article is mentioned below which provides all the details and sample codes about this issue:
Protecting Worksheets

You may download the latest version of this product here:
Aspose.Cells for .NET (Latest Version)

For better understanding and testing a variety of features download a ready to run solution here.