The ConditionalFormatObject describes conditional formatting rules.
To add a new conditional formatting rule, use the addCondition() API call.
To learn more about the usage of the ConditionalFormatObject, check this guide on conditional formatting.
{ formula: string, format: { backgroundColor: string, color: string, fontFamily: string, fontSize: string, fontStyle: string, fontWeight: string, textAlign: string, textIndent: number }, formatCSS: string, id: string, row: number, column: number, measure: string, aggregation: string, hierarchy: string, member: string, isTotal: boolean }
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 Live example. |
format Object | This object stores styles that will be applied to a cell if the condition for the cell value is met. |
format.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" . |
format.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" . |
format.fontFamily String | optional The font family for cells that satisfy the condition. Default value: "Arial" . |
format.fontSize String | optional The font size for cells that satisfy the condition. Default value: "12px" . |
format.fontStyle String | optional The font style for cells that satisfy the condition. |
format.fontWeight String | optional The font weight for cells that satisfy the condition. |
format.textAlign String | optional Text alignment for cells that satisfy the condition. |
format.textIndent Number | optional Text indentation in pixels for cells that satisfy the condition. |
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 automatically 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, set the aggregation property to "none" .See the list of available aggregations. 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. Live example |
member String | optional The unique name of the member to which the condition should be applied. Must be used with the hierarchy property.Live example |
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. |
Conditional formatting guide
addCondition()
getCondition()
getAllConditions()
removeCondition()
removeAllConditions()