Syncfusion.XlsIO.Base
Example 


IconSet Property (IConditionalFormat)

Gets icon set conditional formatting rule. Read-only.
Syntax
'Declaration
 
ReadOnly Property IconSet As IIconSet
'Usage
 
Dim instance As IConditionalFormat
Dim value As IIconSet
 
value = instance.IconSet
IIconSet IconSet {get;}
Remarks
Valid only if FormatType is set to IconSet.
Example
IconSet can be set by setting ExcelCFType.IconSet to FormatType property. To customize the criteria for applying IconSets we have to change properties of IIconSet interface. Here for example, we set values for IIconSet.IconCriteria property.
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["A1"].Text = "IconSets";
            worksheet["A2"].Number = 105;
            worksheet["A3"].Number = 120;
            worksheet["A4"].Number = 300;
            worksheet["A5"].Number = 240;
            worksheet["A6"].Number = 350;
            worksheet["A7"].Number = 460;
            worksheet["A8"].Number = 170;
            worksheet["A9"].Number = 280;
            worksheet["A10"].Number = 190;
            worksheet["A11"].Number = 100;
            
            //Create instance of IConditonalFormat and IConditionalFormats.
            IConditionalFormats formats = worksheet["A2:A11"].ConditionalFormats;
            IConditionalFormat format = formats.AddCondition();
            
            //Set FormatType as IconSet.
            format.FormatType = ExcelCFType.IconSet;
            IIconSet iconSet = format.IconSet;
            
            //Set conditions for IconCriteria.
            iconSet.IconCriteria[1].Type = ConditionValueType.Percentile;
            iconSet.IconCriteria[1].Value = "20";
            iconSet.IconCriteria[1].Operator = ConditionalFormatOperator.GreaterThan;
            
            iconSet.IconCriteria[2].Type = ConditionValueType.Percentile;
            iconSet.IconCriteria[2].Value = "70";
            iconSet.IconCriteria[2].Operator = ConditionalFormatOperator.GreaterThan;
            
            //Save and Dispose.
            workbook.SaveAs("ConditionalFormats.xlsx");
            workbook.Close();
        }
    }
}
AssemblyVersion

Syncfusion.XlsIO.Base: 17.2460.0.34

See Also