Syncfusion.XlsIO.Base
Example 


Item Property (IConditionalFormats)

Gets a conditional format of the specified index from the collection. Read-only.
Syntax
'Declaration
 
ReadOnly Default Property Item( _
   ByVal index As Integer _
) As IConditionalFormat
'Usage
 
Dim instance As IConditionalFormats
Dim index As Integer
Dim value As IConditionalFormat
 
value = instance.Item(index)
IConditionalFormat this[ 
   int index
]; {get;}

Parameters

index
Example
The following code illustrates how to access the first condition from IConditionalFormats.
using Syncfusion.XlsIO;
            
class Example
{
    static void Main()
    {
        using (ExcelEngine excelEngine = new ExcelEngine())
        {
            //Create a worksheet.        
            IApplication application = excelEngine.Excel;
            application.DefaultVersion = ExcelVersion.Excel2013;
            IWorkbook workbook = application.Workbooks.Create(1);
            IWorksheet worksheet = workbook.Worksheets[0];
            
            //Load data to Apply Conditional Formatting.
            worksheet["B1"].Text = "Conditional Formats";
            worksheet["B2"].Number = 10;
            worksheet["B3"].Number = 20;
            worksheet["B4"].Number = 30;
            worksheet["B5"].Number = 40;
            worksheet["B6"].Number = 50;
            worksheet["B7"].Number = 60;
            worksheet["B8"].Number = 70;
            worksheet["B9"].Number = 80;
            worksheet["B10"].Number = 90;
            worksheet["B11"].Number = 100;
            
            //Create instance of IConditonalFormat and IConditionalFormats.
            IConditionalFormats formats = worksheet["B2:B11"].ConditionalFormats;
            
            //Add condition.
            IConditionalFormat format = formats.AddCondition();
            
            //Set Condition. (Access the condition using index).
            formats[0].FirstFormula = "60";
            formats[0].SecondFormula = "20";
            formats[0].Operator = ExcelComparisonOperator.Between;
            
            //Set color.
            formats[0].BackColor = ExcelKnownColors.Red;
            
            //Save and Dispose.
            workbook.SaveAs("ConditionalFormats.xlsx");
            workbook.Close();
        }
    }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 17.1460.0.32

See Also