fontColorRgb property
Gets/sets font color Rgb.
final Workbook workbook = Workbook();
final Worksheet sheet = workbook.worksheets[0];
final CellStyle cellStyle1 = CellStyle(workbook);
cellStyle1.name = 'Style1';
// set fontcolor Rgb.
cellStyle1.fontColorRgb = Color.fromARgb(255, 56, 250, 0);
workbook.styles.addStyle(cellStyle1);
final Range range1 = sheet.getRangeByIndex(1, 1);
range1.cellStyle = cellStyle1;
final List<int> bytes = workbook.saveAsStream();
File('CellStyle.xlsx').writeAsBytes(bytes);
workbook.dispose();
Implementation
@override
Color get fontColorRgb {
Color fontColorStyle = const Color.fromARGB(255, 0, 0, 0);
bool first = true;
final int last = _arrRanges.length;
for (int index = 0; index < last; index++) {
final Range range = _arrRanges[index];
if (first) {
fontColorStyle = range.cellStyle.fontColorRgb;
first = false;
} else if (range.cellStyle.fontColorRgb != fontColorStyle) {
return const Color.fromARGB(255, 0, 0, 0);
}
}
return fontColorStyle;
}
Gets/sets font color Rgb.
final Workbook workbook = Workbook();
final Worksheet sheet = workbook.worksheets[0];
final CellStyle cellStyle1 = CellStyle(workbook);
cellStyle1.name = 'Style1';
// set fontcolor Rgb.
cellStyle1.fontColorRgb = Color.fromARgb(255, 56, 250, 0);
workbook.styles.addStyle(cellStyle1);
final Range range1 = sheet.getRangeByIndex(1, 1);
range1.cellStyle = cellStyle1;
final List<int> bytes = workbook.saveAsStream();
File('CellStyle.xlsx').writeAsBytes(bytes);
workbook.dispose();
Implementation
@override
set fontColorRgb(Color value) {
final int last = _arrRanges.length;
for (int index = 0; index < last; index++) {
final Range range = _arrRanges[index];
range.cellStyle.fontColorRgb = value;
}
}