index property

int index
getter/setter pair

Returns or sets index of the iconset type's individual icon index. /// Returns or sets index of the iconset type's individual icon index.

// 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 iconset for the data in specified range.
final ConditionalFormats conditionalFormats =
    sheet.getRangeByName('A1:A8').conditionalFormats;
final ConditionalFormat conditionalFormat =
    conditionalFormats.addCondition();

//Set FormatType as IconSet.
conditionalFormat.formatType = ExcelCFType.iconSet;
final IconSet iconSet = conditionalFormat.iconSet;

//Set conditions for IconCriteria.
// set iconset.
iconSet.iconSet = ExcelIconSetType.threeSymbols;

final IconConditionValue iconValue1 = iconSet.iconCriteria[0];
iconValue1.iconSet = ExcelIconSetType.fiveBoxes;
// set Index of iconset.
iconValue1.index = 3;
iconValue1.type = ConditionValueType.percent;
iconValue1.value = '25';
iconValue1.operator = ConditionalFormatOperator.greaterThan;

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

Implementation

late int index;