Class IconSet

Class IconSet

Namespace: Aspose.Cells
Assembly: Aspose.Cells.dll (25.2.0)

Describe the IconSet conditional formatting rule. This conditional formatting rule applies icons to cells according to their values.

public class IconSet

Inheritance

objectIconSet

Inherited Members

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Examples

csharp
[C#]

//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();

ca.StartRow = 0;

ca.EndRow = 2;

ca.StartColumn = 0;

ca.EndColumn = 0;

fcs.AddArea(ca);

//Adds condition.
int idx = fcs.AddCondition(FormatConditionType.IconSet);

fcs.AddArea(ca);

FormatCondition cond = fcs[idx];

//Get Icon Set
IconSet iconSet = cond.IconSet;

//Set Icon Type
iconSet.Type = IconSetType.Arrows3;

//Put Cell Values
Aspose.Cells.Cell cell1 = sheet.Cells["A1"];

cell1.PutValue(10);

Aspose.Cells.Cell cell2 = sheet.Cells["A2"];

cell2.PutValue(120);

Aspose.Cells.Cell cell3 = sheet.Cells["A3"];

cell3.PutValue(260);

//Saving the Excel file
workbook.Save("book1.xlsx");

'Instantiating a Workbook object
Dim workbook As Workbook = New Workbook()

Dim sheet As Worksheet = workbook.Worksheets(0)

'Adds an empty conditional formatting
Dim index As Integer = sheet.ConditionalFormattings.Add()

Dim fcs As FormatConditionCollection = sheet.ConditionalFormattings(index)

'Sets the conditional format range.
Dim ca As New CellArea()

ca.StartRow = 0

ca.EndRow = 2

ca.StartColumn = 0

ca.EndColumn = 0

fcs.AddArea(ca)

'Adds condition.
Dim idx As Integer = fcs.AddCondition(FormatConditionType.IconSet)

fcs.AddArea(ca)

Dim cond As FormatCondition = fcs(idx)

'Get Icon Set
Dim iconSet As IconSet = cond.IconSet

'Set Icon Type
iconSet.Type = IconSetType.Arrows3

'Put Cell Values
Dim cell1 As Aspose.Cells.Cell = sheet.Cells("A1")

cell1.PutValue(10)

Dim cell2 As Aspose.Cells.Cell = sheet.Cells("A2")

cell2.PutValue(120)

Dim cell3 As Aspose.Cells.Cell = sheet.Cells("A3")

cell3.PutValue(260)

'Saving the Excel file
workbook.Save("book1.xlsx")

Properties

CfIcons

Get theAspose.Cells.ConditionalFormattingIcon from the collection

public ConditionalFormattingIconCollection CfIcons { get; }

Property Value

ConditionalFormattingIconCollection

Cfvos

Get the CFValueObjects instance.

public ConditionalFormattingValueCollection Cfvos { get; }

Property Value

ConditionalFormattingValueCollection

IsCustom

Indicates whether the icon set is custom. Default value is false.

public bool IsCustom { get; }

Property Value

bool

Reverse

Get or set the flag indicating whether to reverses the default order of the icons in this icon set. Default value is false.

public bool Reverse { get; set; }

Property Value

bool

ShowValue

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.

public bool ShowValue { get; set; }

Property Value

bool

Type

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.

public IconSetType Type { get; set; }

Property Value

IconSetType