timePeriodType property
Gets or sets one of the constants of
// 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');
final now = DateTime.now();
sheet
.getRangeByIndex(2, 1)
.setDateTime(DateTime(now.year, now.month, now.day - 1));
sheet
.getRangeByIndex(3, 1)
.setDateTime(DateTime(now.year, now.month, now.day));
sheet
.getRangeByIndex(4, 1)
.setDateTime(DateTime(now.year, now.month, now.day + 1));
sheet
.getRangeByIndex(5, 1)
.setDateTime(DateTime(now.year, now.month, now.day - 1));
sheet
.getRangeByIndex(6, 1)
.setDateTime(DateTime(now.year, now.month, now.day + 1));
sheet
.getRangeByIndex(7, 1)
.setDateTime(DateTime(now.year, now.month, now.day - 1));
sheet
.getRangeByIndex(8, 1)
.setDateTime(DateTime(now.year, now.month, now.day - 1));
sheet
.getRangeByIndex(9, 1)
.setDateTime(DateTime(now.year, now.month, now.day));
sheet
.getRangeByIndex(10, 1)
.setDateTime(DateTime(now.year, now.month, now.day + 1));
// Applying conditional formatting to "A1:A11".
final ConditionalFormats conditions =
sheet.getRangeByName('A1:A10').conditionalFormats;
final ConditionalFormat condition1 = conditions.addCondition();
//Set formatType.
condition1.formatType = ExcelCFType.timePeriod;
//Set CF Time period.
condition1.timePeriodType = CFTimePeriods.tomorrow;
//Set Color
condition1.backColor = '#FF00FF';
//save and dispose.
final List<int> bytes = workbook.saveAsStream();
File('ConditionalFormats.xlsx').writeAsBytes(bytes);
workbook.dispose();
Implementation
late CFTimePeriods timePeriodType;