Aspose::Cells::IconSet class

IconSet class

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

class IconSet

Methods

MethodDescription
GetCfIcons()Get theConditionalFormattingIcon from the collection.
GetCfvos()Get the CFValueObjects instance.
GetReverse()Get or set the flag indicating whether to reverses the default order of the icons in this icon set. Default value is false.
GetShowValue()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.
GetType()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.
IconSet(IconSet_Impl* impl)Constructs from an implementation object.
IconSet(const IconSet& src)Copy constructor.
IsCustom()Indicates whether the icon set is custom. Default value is false.
IsNull() constChecks whether the implementation object is nullptr.
explicit operator bool() constoperator bool()
operator=(const IconSet& src)operator=
SetReverse(bool value)Get or set the flag indicating whether to reverses the default order of the icons in this icon set. Default value is false.
SetShowValue(bool value)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.
SetType(IconSetType value)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.
~IconSet()Destructor.

Fields

FieldDescription
_implThe implementation object.

Examples

Aspose::Cells::Startup();
//Instantiating a Workbook object
Workbook workbook;

Worksheet sheet = workbook.GetWorksheets().Get(0);

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

FormatConditionCollection fcs = sheet.GetConditionalFormattings().Get(index);

//Sets the conditional format range.
CellArea ca;
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.Get(idx);

//Get Icon Set
IconSet iconSet = cond.GetIconSet();

//Set Icon Type
iconSet.SetType(IconSetType::Arrows3);

//Put Cell Values
Cell cell1 = sheet.GetCells().Get(u"A1");
cell1.PutValue(10);

Cell cell2 = sheet.GetCells().Get(u"A2");
cell2.PutValue(120);

Cell cell3 = sheet.GetCells().Get(u"A3");
cell3.PutValue(260);

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

Aspose::Cells::Cleanup();

See Also