Syncfusion.XlsIO.Base
Example 


IncludeProtection Property

True if the style includes the FormulaHidden and Locked protection properties. Read / write Boolean.
Syntax
'Declaration
 
Property IncludeProtection As Boolean
'Usage
 
Dim instance As IExtendedFormat
Dim value As Boolean
 
instance.IncludeProtection = value
 
value = instance.IncludeProtection
bool IncludeProtection {get; set;}
Example
The following code illustrates how to set IncludeProtection property.
using Syncfusion.XlsIO;
            
class Program
{
    static void Main()
    {
        using (ExcelEngine excelEngine = new ExcelEngine())
        {
            //Create worksheet
            IApplication application = excelEngine.Excel;
            application.DefaultVersion = ExcelVersion.Excel2013;
            IWorkbook workbook = application.Workbooks.Create(1);
            IWorksheet worksheet = workbook.Worksheets[0];
            
            //Load values
            worksheet["B2"].Value = "10";
            worksheet["C2"].Value = "20";
            
            //Create style
            IStyle style = workbook.Styles.Add("CustomStyle");
            
            //Set style
            worksheet["B2"].CellStyle = style;
            
            //Set locked
            style.Locked = false;
            
            //Set IncludeProtection
            style.IncludeProtection = false;
            
            //Get extended format
            IExtendedFormat format = worksheet["C2"].CellStyle;
            
            //Set locked
            format.Locked = false;
            
            //Set IncludeProtection
            format.IncludeProtection = false;
            
            //Enable sheet protection
            worksheet.Protect("", ExcelSheetProtection.All);
            
            //Save and dispose
            workbook.SaveAs("CellFormats.xlsx");
            workbook.Close();
        }
    }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 17.1460.0.32

See Also