diff --git a/Conditional Formatting/Create Conditional Format/.NET/Create Conditional Format/Create Conditional Format/Program.cs b/Conditional Formatting/Create Conditional Format/.NET/Create Conditional Format/Create Conditional Format/Program.cs index 9ef6bf65..35939bcc 100644 --- a/Conditional Formatting/Create Conditional Format/.NET/Create Conditional Format/Create Conditional Format/Program.cs +++ b/Conditional Formatting/Create Conditional Format/.NET/Create Conditional Format/Create Conditional Format/Program.cs @@ -57,6 +57,18 @@ static void Main(string[] args) //Setting back color to target range condition3.BackColor = ExcelKnownColors.Light_green; + //Applying conditional formatting to "A7" + condition = worksheet.Range["A7"].ConditionalFormats; + IConditionalFormat condition4 = condition.AddCondition(); + + //Set conditional format rule that the cell value is a date in the next week + condition4.FormatType = ExcelCFType.TimePeriod; + condition4.TimePeriodType = CFTimePeriods.NextWeek; + worksheet.Range["A7"].Text = "Enter a date of next week"; + + //Setting back color to target range + condition4.BackColor = ExcelKnownColors.Light_blue; + #region Save //Saving the workbook FileStream outputStream = new FileStream(Path.GetFullPath("Output/ConditionalFormat.xlsx"), FileMode.Create, FileAccess.Write);