ConditionalFormattingIconCollection Class

Represents a collection of ConditionalFormattingIcon objects.
Inheritance Hierarchy

Namespace:  Aspose.Cells
Assembly:  Aspose.Cells (in Aspose.Cells.dll) Version: (20.10)
public class ConditionalFormattingIconCollection : CollectionBase

The ConditionalFormattingIconCollection type exposes the following members.

Public propertyCapacity (Inherited from CollectionBase.)
Public propertyCount (Inherited from CollectionBase.)
Protected propertyInnerList (Inherited from CollectionBase.)
Public propertyItem
Gets the ConditionalFormattingIcon element at the specified index.
Protected propertyList (Inherited from CollectionBase.)
Public methodAdd(ConditionalFormattingIcon)
Public methodAdd(IconSetType, Int32)
Public methodClear (Inherited from CollectionBase.)
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetEnumerator (Inherited from CollectionBase.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Protected methodOnClear (Inherited from CollectionBase.)
Protected methodOnClearComplete (Inherited from CollectionBase.)
Protected methodOnInsert (Inherited from CollectionBase.)
Protected methodOnInsertComplete (Inherited from CollectionBase.)
Protected methodOnRemove (Inherited from CollectionBase.)
Protected methodOnRemoveComplete (Inherited from CollectionBase.)
Protected methodOnSet (Inherited from CollectionBase.)
Protected methodOnSetComplete (Inherited from CollectionBase.)
Protected methodOnValidate (Inherited from CollectionBase.)
Public methodRemoveAt (Inherited from CollectionBase.)
Public methodToString (Inherited from Object.)

//Instantiating a Workbook object
Workbook workbook = new Workbook();

Worksheet sheet = workbook.Worksheets[0];

//Get Conditional Formatting
ConditionalFormattingCollection cformattings = sheet.ConditionalFormattings;

//Adds an empty conditional formatting
int index = cformattings.Add();

//Get newly added Conditional formatting
FormatConditionCollection fcs = cformattings[index];

//Sets the conditional format range.
CellArea ca = new CellArea();

ca.StartRow = 0;

ca.EndRow = 0;

ca.StartColumn = 0;

ca.EndColumn = 0;


ca = new CellArea();

ca.StartRow = 1;

ca.EndRow = 1;

ca.StartColumn = 1;

ca.EndColumn = 1;


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

 FormatCondition cond = fcs[idx];

 //Sets condition's type
 cond.IconSet.Type = IconSetType.ArrowsGray3;

//Add custom iconset condition.
 ConditionalFormattingIcon cfIcon = cond.IconSet.CfIcons[0];

 cfIcon.Type = IconSetType.Arrows3;

 cfIcon.Index = 0;

 ConditionalFormattingIcon cfIcon1 = cond.IconSet.CfIcons[1];

  cfIcon1.Type = IconSetType.ArrowsGray3;

  cfIcon1.Index = 1;

  ConditionalFormattingIcon cfIcon2 = cond.IconSet.CfIcons[2];

  cfIcon2.Type = IconSetType.Boxes5;

  cfIcon2.Index = 2;

//Saving the Excel file


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

Dim sheet As Worksheet = workbook.Worksheets(0)

'Get Conditional Formatting
Dim cformattings As ConditionalFormattingCollection = sheet.ConditionalFormattings

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

'Get newly added Conditional formatting
Dim fcs As FormatConditionCollection = cformattings(index)

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

ca.StartRow = 0

ca.EndRow = 0

ca.StartColumn = 0

ca.EndColumn = 0


ca = New CellArea()

ca.StartRow = 1

ca.EndRow = 1

ca.StartColumn = 1

ca.EndColumn = 1


//Sets condition
Dim idx As Integer =fcs.AddCondition(FormatConditionType.IconSet)

Dim cond As FormatCondition=fcs[idx]

//Sets condition's type
cfIcon.Type = IconSetType.ArrowsGray3

'Add custom iconset  condition.
Dim cfIcon As ConditionalFormattingIcon = cond.IconSet.CfIcons[0]

cfIcon.Type = IconSetType.Arrows3


Dim cfIcon1 As ConditionalFormattingIcon = cond.IconSet.CfIcons[1]

cfIcon1.Type = IconSetType.ArrowsGray3


Dim cfIcon2 As ConditionalFormattingIcon = cond.IconSet.CfIcons[2]

cfIcon2.Type = IconSetType.Boxes5


'Saving the Excel file
See Also