Get Free Trial
API reference
Table of contents

ConditionalFormatObject

The ConditionalFormatObject describes conditional formatting rules. For more details, check this tutorial: Conditional formatting.

Available properties

The ConditionalFormatObject has the following properties:

Property/Type Description
formula
String
A condition that can contain the following logical operators: AND, OR, ==, !=, >, <, >=, <=, +, -, *, /, isNaN(), !isNaN().
#value is used as a reference to the cell value in the condition. Example: "#value > 2".
To refer to another field’s value in the condition, use the field’s name. Example: "'Price' > 2".
format
FormatStyleObject
The style object that will be applied to a cell if the condition for the cell value is met.
formatCSS
String
optional Read-only property. Represents a ready-to-use CSS string of the format style object. The format style object has properties with names that differ from CSS. The component transforms format to formatCSS.
id
String
optional The id of the conditional formatting rule. If the id property is not set, the id for the rule will be set inside the pivot component.
row
Number
optional The row index to which the condition should be applied.
column
Number
optional The column index to which the condition should be applied.
measure
String
optional The unique measure name to which the condition should be applied. Must be used with the aggregation property unless the measure is calculated.
aggregation
String
optional The aggregation of the measure to which the condition should be applied. If the measure is calculated, skip the aggregation property.
Not supported for the "microsoft analysis services" data source type.
hierarchy
String
optional The unique name of the field to which the condition should be applied. Must be used with the member property.
member
String
optional The unique name of the member to which the condition should be applied. Must be used with the hierarchy property.
isTotal
Boolean
optional If it is not defined, the condition will be applied to all cells. If it is set to true, the condition will be applied to total and subtotal cells only. If it is set to false, the condition will be applied to regular cells only.

FormatStyleObject

Property/Type Description
backgroundColor
String
optional The background color for cells that satisfy the condition. If you want to export the pivot table to Excel and PDF, the backgroundColor should be set to hex color codes.
Default value: "#FFFFFF".
color
String
optional The font color for cells that satisfy the condition. If you want to export the pivot table to Excel and PDF, the color should be set to hex color codes.
Default value: "#000000".
fontFamily
String
optional The font family for cells that satisfy the condition.
Default value: "Arial".
fontSize
String
optional The font size for cells that satisfy the condition.
Default value: "12px".

To add new conditional formatting rule use addCondition() API call.

To learn more about the usage of the ConditionalFormatObject, check this guide on conditional formatting.

See also

Conditional formatting guide
addCondition()
getCondition()
getAllConditions()
removeCondition()
removeAllConditions()