Excel Conditional Formatting

The IronXL library supports Conditional Formatting of cells and ranges. Conditional Formatting makes changing the style of the cell, such as background color, or the style of text based on logical/programmatic rules.

Use CreateConditionalFormattingRule(string formula) to create a conditional formatting rule based on a Boolean formula. When the formula result is true, the cell is highlighted. Please note that the formula to evaluate. MUST be a Boolean function.

The CreateConditionalFormattingRule method with three parameters can only take ComparisonOperator.Between and ComparisonOperator.NotBetween as the first parameter.

Use conditional formatting to highlight cells and ranges with specified color and format combinations that are dependent on the cell's true/false value determined by set rules. This allows the ability to analyze data, detect issues and identify patterns and trends.

How to Use Excel Conditional Formatting in C#

  1. Set up an Excel library to use Excel Conditional Formatting.
  2. Open the current Excel file.
  3. Select a default Worksheet
  4. Format the data using the Workbook object's formatting option.
  5. Save the Workbook to an Excel file