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

Free Support Forum - aspose.com

Write protect a worksheet

I didn’t found a way to protect(write protect) a worksheet.
Is it possible to do that? How?
I need a quick answer.

Hi, thanks for your consideration.

Now you can create a designer file with sheet-protected. Then you can use Aspose.Excel to read it and put your data.

I will investigate to add an API to enable you to do so.

Yes, it is a solution, but I would like to set the protection from code.
I will use it the way you said for now, but I’d love to set it using the API.
When the new API will have this feature, please reply to this post.

Thank you.

Sure.

I plan to provide this api in the next month.

Now thanks for your patience.

OK.

Thank you

Hi,

Now you can use Worksheet.Protect to protect a worksheet. Please download 1.8.0.0.

It works.

Thanks for your quick support.

Calin

@calinberindea,
Aspose.Excel is discontinued now and is replaced with a latest version Aspose.Cells containing lot of new advanced features and support to all the latest versions of MS Excel. This new product provides rich security features for Excel files. You may try the following example which protects worksheet using this new library:

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

For more information on opening different versions of Excel files, please follow the link below:
Security Features

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.