NativeExcel for .Net Developer's Reference

IWorksheet.Protection Property

Returns an IProtection interface that represents the various types of protection options available for a worksheet.

[Visual Basic]
Property ReadOnly Protection As IProtection
[C#]
IProtection Protection { get; }
[C++]
__property IProtection* get_Protection();
[JScript]
function get Protection() : IProtection

Property Value

IProtection interface.

Example

This example changes the protection options for sheet one

[C#]
book.Worksheets[1].Protection.AllowDeletingColumns = true;
[Visual Basic]
book.Worksheets(i).Protection.AllowDeletingColumns = True
[C++]
book->Worksheets->Item[i]->Protection->AllowDeletingColumns = true;

See Also

IWorksheet Interface | NativeExcel Namespace