[]
        
(Showing Draft Content)

Conditional Formatting

SpreadJS supports conditional formatting in cells. You can use various styles to set the visual appearance of the formatted cell.


Conditional formatting can be applied to worksheets via conditional formatting rules. Classes such as ConditionalFormatting and ConditionalFormats can be used to access various different methods and enumeration options.


There are several types of conditional rules. The following table lists the rules and their descriptions:

Rule

Description

Average Rule

The average rule checks for values above or under the average.

Cell Value Rule

The cell value rule compares values.

Data Bar Rule

The data bar rule uses a bar that is displayed as the background for each cell. The length of the bar is based on the cell value.

Date Occurring Rule

The date rule compares dates.

Duplicate Rule

The duplicate rule checks for duplicate values.

Formula Rule

The formula rule allows you to use formulas when checking the condition.

Icon Set Rule

The icon set rule displays icons based on the values. You can specify the type of icon and whether to show the icon or the icon and the data in the cell.

Scale Rule

The scale rule uses a sliding color scale.

Specific Text Rule

The specific text rule searches for text strings.

Top 10 Rule

The top 10 rule checks for values in the top or bottom of the range.

Unique Rule

The unique rule checks to see if the value is the only one of that value in the range.

Priority of Conditional Formats

These rules have an order of precedence. The last rule in a list of rules has the highest precedence. The first rule in the list has the lowest precedence. By default, new rules are always added last and have the highest precedence. When two rules conflict, the rule with higher precedence is applied. If two rules do not conflict (one rule uses a bold font and the other rule uses a cell back color), then both rules are applied.