iconSet property

IconSet? iconSet
getter/setter pair

Gets icon set conditional formatting rule.

// Create a new Excel Document.
final Workbook workbook = Workbook();
// Accessing sheet via index.
final Worksheet sheet = workbook.worksheets[0];

sheet.getRangeByName('A1').number = 125;
sheet.getRangeByName('A2').number = 279;
sheet.getRangeByName('A3').number = 42;
sheet.getRangeByName('A4').number = 384;
sheet.getRangeByName('A5').number = 129;
sheet.getRangeByName('A6').number = 212;
sheet.getRangeByName('A7').number = 131;
sheet.getRangeByName('A8').number = 230;

//Create icon set for the data in specified range.
final ConditionalFormats conditionalFormats =
    sheet.getRangeByName('A1:A8').conditionalFormats;
final ConditionalFormat conditionalFormat =
    conditionalFormats.addCondition();

conditionalFormat.formatType = ExcelCFType.iconSet;
final IconSet iconSet = conditionalFormat.iconSet;

iconSet.iconSet = ExcelIconSetType.threeSymbols;
iconSet.iconCriteria[1].type = ConditionValueType.percent;
iconSet.iconCriteria[1].value = "30";
iconSet.iconCriteria[2].type = ConditionValueType.percent;
iconSet.iconCriteria[2].value = "60";
iconSet.showIconOnly = true;

final List<int> bytes = workbook.saveAsStream();
  File('Iconset.xlsx').writeAsBytes(bytes);
  workbook.dispose();

Implementation

IconSet? iconSet;