Skip to content

Commit

Permalink
Conditional Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Kurmitha4004 committed Oct 23, 2024
1 parent ee17705 commit 98861ce
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 98861ce

Please sign in to comment.