Build 3.0.0.25 of xlsgen adds support for time-based conditional formattings for XLS and XLSX files.
With this build, xlsgen completes support for all conditional formattings (some were recently introduced in Excel 2007 and Excel 2010).
Time-based conditions are, as the name suggests, a mechanism for highlighting cells whenever a date matches the condition. For instance a condition may be "tomorrow", in turn if we are say thursday March 29, 2012, then all cells having a date such as March 30, 2012 will be highlighted.
Time-based conditions are presented in the xlsgen object model as predefined conditions, and they are internally translated into Excel formulas. Therefore, they are also evaluated accordingly (for instance, when rendering a sheet).
A new enumeration type makes its appearance :
typedef enum
{
conditionaltimeperiod_today = 0;
conditionaltimeperiod_yesterday = 1;
conditionaltimeperiod_tomorrow = 2;
conditionaltimeperiod_last7days = 3;
conditionaltimeperiod_thismonth = 4;
conditionaltimeperiod_lastmonth = 5;
conditionaltimeperiod_nextmonth = 6;
conditionaltimeperiod_thisweek = 7;
conditionaltimeperiod_lastweek = 8;
conditionaltimeperiod_nextweek = 9;
} enumConditionalTimePeriod;
Here is an example showing how to use the new time-based conditional formattings :
xlsgen::IXlsConditionalFormattingPtr cf = wksht001->NewRange(L"C2:C8")->NewConditionalFormatting();
cf->PredefinedCondition->DatesMatchingPeriod(xlsgen::conditionaltimeperiod_nextmonth);
cf->Style = style0002;