Class IconSet
Contents
[
Hide
]IconSet class
Describe the IconSet conditional formatting rule. This conditional formatting rule applies icons to cells according to their values.
public class IconSet
Properties
Name | Description |
---|---|
CfIcons { get; } | Get theConditionalFormattingIcon from the collection |
Cfvos { get; } | Get the CFValueObjects instance. |
IsCustom { get; } | Indicates whether the icon set is custom. Default value is false. |
Reverse { get; set; } | Get or set the flag indicating whether to reverses the default order of the icons in this icon set. Default value is false. |
ShowValue { get; set; } | Get or set the flag indicating whether to show the values of the cells on which this icon set is applied. Default value is true. |
Type { get; set; } | Get or Set the icon set type to display. Setting the type will auto check if the current Cfvos’s count is accord with the new type. If not accord, old Cfvos will be cleaned and default Cfvos will be added. |
Examples
namespace AsposeCellsExamples
{
using Aspose.Cells;
using System;
public class IconSetDemo
{
public static void IconSetExample()
{
// Instantiating a Workbook object
Workbook workbook = new Workbook();
Worksheet sheet = workbook.Worksheets[0];
// Adds an empty conditional formatting
int index = sheet.ConditionalFormattings.Add();
FormatConditionCollection fcs = sheet.ConditionalFormattings[index];
// Sets the conditional format range
CellArea ca = new CellArea
{
StartRow = 0,
EndRow = 2,
StartColumn = 0,
EndColumn = 0
};
fcs.AddArea(ca);
// Adds condition
int idx = fcs.AddCondition(FormatConditionType.IconSet);
FormatCondition cond = fcs[idx];
// Get Icon Set
IconSet iconSet = cond.IconSet;
// Set Icon Type
iconSet.Type = IconSetType.Arrows3;
// Set additional properties
iconSet.ShowValue = true;
iconSet.Reverse = false;
// Put Cell Values
sheet.Cells["A1"].PutValue(10);
sheet.Cells["A2"].PutValue(120);
sheet.Cells["A3"].PutValue(260);
// Saving the Excel file
workbook.Save("IconSetExample.xlsx");
workbook.Save("IconSetExample.pdf");
}
}
}
See Also
- namespace Aspose.Cells
- assembly Aspose.Cells