count property

int count
getter/setter pair

Gets the number of conditional formats in the collection. Read-only.

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

 sheet.getRangeByIndex(1, 1).setText('Conditional Formts');
 sheet.getRangeByIndex(2, 1).setNumber(10);
 sheet.getRangeByIndex(3, 1).setNumber(20);
 sheet.getRangeByIndex(4, 1).setNumber(30);
 sheet.getRangeByIndex(5, 1).setNumber(40);
 sheet.getRangeByIndex(6, 1).setNumber(50);
 sheet.getRangeByIndex(7, 1).setNumber(60);
 sheet.getRangeByIndex(8, 1).setNumber(70);
 sheet.getRangeByIndex(9, 1).setNumber(80);
 sheet.getRangeByIndex(10, 1).setNumber(90);
 sheet.getRangeByIndex(11, 1).setNumber(100);

 //Applying conditional formatting to "A1:A11".
 final ConditionalFormats conditions =
    sheet.getRangeByName('A1:A11').conditionalFormats;
 final ConditionalFormat condition1 = conditions.addCondition();
 final ConditionalFormat condition2 = conditions.addCondition();
 final ConditionalFormat condition3 = conditions.addCondition();

 //set conditions
 condition1.formatType = ExcelCFType.cellValue;
 condition1.operator = ExcelComparisonOperator.between;
 condition1.firstFormula = '30';
 condition1.secondFormula = '70';

 //Set color.
 condition1.backColor = '#66FF99';

 //set conditions
 condition2.formatType = ExcelCFType.cellValue;
 condition2.operator = ExcelComparisonOperator.between;
 condition2.firstFormula = '30';
 condition2.secondFormula = '50';

 //Set color.
 condition2.backColor = '#99FF66';

 //set conditions
 condition3.formatType = ExcelCFType.cellValue;
 condition3.operator = ExcelComparisonOperator.between;
 condition3.firstFormula = '20';
 condition3.secondFormula = '60';

 //Set color.
 condition3.backColor = '#FF9966';

 //Check Count.
 print(conditions.count);

 //save and dispose.
 final List<int> bytes = workbook.saveAsStream();
 File('ConditionalFormatting.xlsx').writeAsBytes(bytes);
 workbook.dispose();

Implementation

late int count;