UConditionalFormatRule

IConditionlFormattingRule, from Univer See doc:

public struct UConditionalFormatRule

Remarks

Represents a conditional formatting rule in a spreadsheet, encapsulating the rule configuration and metadata such as range, ID, and behavior flags. The rule itself is stored as a JSON object to enable flexible deserialization of various conditional format types (e.g., HighlightCell, DataBar, etc).

Properties

Property Type Description
ranges List Ranges to apply the conditional format
cfId string Id for the conditional format
stopIfTrue bool True if only apply to 1 element to stop
rule JsonObject Rule object for the conditional format. See doc for every single combination (This is serialized as a JsonObject to reduce code)

Methods

GetTypeConditionalFormat

public ECFRuleType? GetTypeConditionalFormat()

Returns the type of conditional format inside “rule” JsonObject. Returns null if rule or the “type” key doesn’t exist.

Returns:

ECFRuleType? — Type of conditional format as enum


GetSubType

public ECFSubRuleType? GetSubType()

Returns the SubType of the conditional format inside “rule” JsonObject. Only applicable for “highlightCell” type.

Returns:

ECFSubRuleType? — Subtype for highlightCell conditional format


GetOperator

public ECFOperators? GetOperator()

Returns the operator at the root node in “rule” JsonObject. Only applicable for “highlightCell” type and: “text”, “timePeriod”, “number” and “average” SubTypes.

Returns:

ECFOperators? — Operator used in the conditional rule


GetStyleUsed

public IStyleBase? GetStyleUsed()

Returns the style object at the root node in “rule” JsonObject. Only applicable for “highlightCell” type.

Returns:

IStyleBase? — Style object applied to the conditional format


GetDataBarConfig

public UDataBarConfig? GetDataBarConfig()

Returns the configuration object for the Data Bar Conditional Format. Only applicable for “dataBar” type.

Returns:

UDataBarConfig? — DataBar configuration object


GetColorScaleConfigs

public UColorScaleConfig[] GetColorScaleConfigs()

Returns the configuration object for the Color Scale Conditional Format. Only applicable for “colorScale” type.

Returns:

UColorScaleConfig[] — Color scale configuration array


GetIconSetConfigs

public UIconSetConfig[] GetIconSetConfigs()

Returns the configuration object for the Icon Set Conditional Format. Only applicable for “iconSet” type.

Returns:

UIconSetConfig[] — Icon set configuration array