- Document Solutions for Excel, .NET Edition Overview
- Key Features
- Getting Started
-
Features
- Worksheet
- Workbook
- Comments
- Hyperlinks
- Sort
- Filter
- Group
- Conditional Formatting
- Data Validations
- Data Binding
- Import Data
- Digital Signatures
- Formulas
- Custom Functions
- Shapes
- Document Properties
- Styles
- Form Controls
- Barcodes
- Themes and Colors
- Chart
- Table
- Pivot Table
- Pivot Chart
- Sparkline
- Slicer
- Logging
- Defined Names
- Templates
- File Operations
- Document Solutions Data Viewer
- API Reference
- Release Notes
(Showing Draft Content)
Date Occurring Rule
The date occurring rule in conditional formatting feature compares the values entered in date format in the cells or a range of cells. This rule can be added using the DateOperator property of the IFormatCondition interface.
Refer to the following example code to add date occurring rule to a range of cells in a worksheet.
// Adding Date occuring rules
IFormatCondition condition = worksheet.Range["A1:A4"].FormatConditions.Add(FormatConditionType.TimePeriod) as IFormatCondition;
condition.DateOperator = TimePeriods.Yesterday;
condition.Interior.Color = Color.FromArgb(128, 0, 128);
DateTime now = DateTime.Today;
worksheet.Range["A1"].Value = now.AddDays(-2);
worksheet.Range["A2"].Value = now.AddDays(-1);
worksheet.Range["A3"].Value = now;
worksheet.Range["A4"].Value = now.AddDays(1);