Add Icon Sets Rule

Spread.Services Documentation
Add Icon Sets Rule
Collapse All Expand All

Spread.Services Documentation > Developer's Guide > Apply Conditional Formatting > Add Icon Sets Rule

The icon sets rule in conditional formatting displays the icons on the basis of values entered in the cells. Each value represents a distinct icon that appears in a cell if it matches the icon sets rule applied on it. This rule can be added using the properties and methods of the IIconSetCondition interface.

Refer to the following example code to add icon sets rule in a worksheet.

C# | Copy Code
--- | ---

    // Adding IconSets rule
    IIconSetCondition condition = worksheet.Range["A1:A5"].FormatConditions.AddIconSetCondition();
    condition.IconSet = workbook.IconSets[IconSetType.Icon3Symbols];
    condition.IconCriteria[1].Operator = FormatConditionOperator.GreaterEqual;
    condition.IconCriteria[1].Value = 50;
    condition.IconCriteria[1].Type = ConditionValueTypes.Percent;
    condition.IconCriteria[2].Operator = FormatConditionOperator.GreaterEqual;
    condition.IconCriteria[2].Value = 70;
    condition.IconCriteria[2].Type = ConditionValueTypes.Percent;

    worksheet.Range["A1"].Value = 1;
    worksheet.Range["A2"].Value = 2;
    worksheet.Range["A3"].Value = 3;
    worksheet.Range["A4"].Value = 4;
    worksheet.Range["A5"].Value = 5;

Copyright © GrapeCity, inc. All rights reserved.