How can we check if a worksheet is protected

Hello,

I was wondering if there is a way to find out if any one worksheet in a workbook is protected - maybe a simple boolean indicating true or false?

Thank you.

I will add a Worksheet.IsProtected property to meet your need. It will be available in next week.

Please download hotfix 2.3.3. It’s available. Please refer to http://www.aspose.com/Products/Aspose.Excel/Api/Aspose.Excel.Worksheet.IsProtected.html.

@Jeselon,
Aspose.Cells has replaced Aspose.Excel which is no more continued now. Aspose.Cells contains all the previous features of Aspose.Excel as well as latest features in recent MS Excel versions. This new product supports all the features for protecting and un-protecting a workbook and individual worksheet. Here is an example which demonstrates protecting a worksheet.

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

// 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 are the articles which contains detailed information about protecting/un-protecting a workbook and worksheet:
Protecting and Unprotecting Workbooks
Protecting Worksheets

The latest free trial version of this product can be downloaded here:
Aspose.Cells for .NET (Latest Version)

You can test different features of this new product by downloading an executable solution here.