fontColorRgb property
Gets or sets the background color from Rgb.
// 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('A2:A11').conditionalFormats;
final ConditionalFormat condition1 = conditions.addCondition();
//Set formatType.
condition1.formatType = ExcelCFType.cellValue;
//Set operators.
condition1.operator = ExcelComparisonOperator.greater;
//Set firstFormula.
condition1.firstFormula = '30';
//Set back color Rgb.
condition1.fontColorRgb = Color.fromARGB(234, 15, 135, 145);;
//save and dispose.
final List<int> bytes = workbook.saveAsStream();
File('ConditionalFormats.xlsx').writeAsBytes(bytes);
workbook.dispose();
Implementation
late Color fontColorRgb;