aspose.cells

Class IconSet

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

Example:

//Instantiating a Workbook object
var workbook = new aspose.cells.Workbook();

var sheet = workbook.getWorksheets().get(0);

//Adds an empty conditional formatting
var index = sheet.getConditionalFormattings().add();

var fcs = sheet.getConditionalFormattings().get(index);

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

ca.StartRow = 0;

ca.EndRow = 2;

ca.StartColumn = 0;

ca.EndColumn = 0;

fcs.addArea(ca);

//Adds condition.
var idx = fcs.addCondition(aspose.cells.FormatConditionType.ICON_SET);

fcs.addArea(ca);

var cond = fcs.get(idx);

//Get Icon Set
var iconSet = cond.getIconSet();

//Set Icon Type
iconSet.setType(aspose.cells.IconSetType.ARROWS_3);

//Put Cell Values
var cell1 = sheet.getCells().get("A1");

cell1.putValue(10);

var cell2 = sheet.getCells().get("A2");

cell2.putValue(120);

var cell3 = sheet.getCells().get("A3");

cell3.putValue(260);

//Saving the Excel file
workbook.save("D:\\book1.xlsx");

Property Getters/Setters Summary
functiongetCfIcons()
Get theConditionalFormattingIcon from the collection
functiongetCfvos()
Get the CFValueObjects instance.
functionisCustom()
Indicates whether the icon set is custom. Default value is false.
functiongetReverse()
function
setReverse(value)
           Get or set the flag indicating whether to reverses the default order of the icons in this icon set. Default value is false.
functiongetShowValue()
function
           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.
functiongetType()
function
setType(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. The value of the property is IconSetType integer constant.
 

    • Property Getters/Setters Detail

      • getType/setType : Number 

        function getType() / function setType(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. The value of the property is IconSetType integer constant.
      • isCustom : boolean 

        function isCustom()
        
        Indicates whether the icon set is custom. Default value is false.
      • getShowValue/setShowValue : boolean 

        function getShowValue() / function setShowValue(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.
      • getReverse/setReverse : boolean 

        function getReverse() / function setReverse(value)
        
        Get or set the flag indicating whether to reverses the default order of the icons in this icon set. Default value is false.