Syncfusion.XlsIO.Base
Example 


Syncfusion.XlsIO Namespace > ITabSheet Interface > Protect Method : Protect(String,ExcelSheetProtection) Method
Represents a password to protect.
Represents sheet protection option.

Protect(String,ExcelSheetProtection) Method

Protects a sheet with specified password and ExcelSheetProtection so that it cannot be modified.
Syntax
'Declaration
 
Overloads Sub Protect( _
   ByVal password As String, _
   ByVal options As ExcelSheetProtection _
) 
'Usage
 
Dim instance As ITabSheet
Dim password As String
Dim options As ExcelSheetProtection
 
instance.Protect(password, options)

Parameters

password
Represents a password to protect.
options
Represents sheet protection option.
Example
Following code illustrates how to protect the sheet with Excel sheet protection option.
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
ITabSheet sheet = workbook.Worksheets[0];
            
// Protect the sheet 
sheet.Protect("Syncfusion");
            
workbook.SaveAs("Protect.xlsx");
workbook.Close();
excelEngine.Dispose();
AssemblyVersion

Syncfusion.XlsIO.Base: 16.4460.0.40

See Also