topBottom property
Gets TopBottom conditional formatting rule. Read-only.
// create a Excel document.
final Workbook workbook = Workbook();
// Accessing sheet via index.
final Worksheet sheet = workbook.worksheets[0];
// Setting value in the cell.
sheet.getRangeByIndex(1, 1).setText('Mark');
sheet.getRangeByIndex(2, 1).setNumber(29);
sheet.getRangeByIndex(3, 1).setNumber(13);
sheet.getRangeByIndex(4, 1).setNumber(88);
sheet.getRangeByIndex(5, 1).setNumber(98);
sheet.getRangeByIndex(6, 1).setNumber(60);
sheet.getRangeByIndex(7, 1).setNumber(69);
sheet.getRangeByIndex(8, 1).setNumber(49);
sheet.getRangeByIndex(9, 1).setNumber(100);
sheet.getRangeByIndex(10, 1).setNumber(19);
// Applying conditional formatting.
final ConditionalFormats conditions =
sheet.getRangeByName('A1:A10').conditionalFormats;
final ConditionalFormat condition = conditions.addCondition();
//Applying top or bottom rule in the conditional formatting.
condition.formatType = ExcelCFType.topBottom;
final TopBottom topBottom = condition.topBottom!;
//Set type as Top for TopBottom rule.
topBottom.type = ExcelCFTopBottomType.top;
//Set true to Percent property for TopBottom rule.
topBottom.percent = true;
//Set rank value for the TopBottom rule.
topBottom.rank = 50;
//Setting format properties to be applied when the above condition is met.
condition.backColor = '#934ADD';
condition.isBold = true;
//save and dispose.
final List<int> bytes = workbook.saveAsStream();
File('CFTopBottom.xlsx').writeAsBytes(bytes);
workbook.dispose();
Implementation
TopBottom? topBottom;