Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

261500- Add Conditional Formatting for Date in Excel #146

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading