pub enum ConditionalFormattingCondition {
CellIs {
operator: ComparisonOperator,
formula1: String,
formula2: Option<String>,
},
Expression {
formula: String,
},
ColorScale(Vec<ColorScaleStop>),
DataBar {
min: CfvoPosition,
max: CfvoPosition,
color: String,
},
IconSet(IconSetType),
Top10 {
rank: u32,
percent: bool,
bottom: bool,
},
AboveAverage {
above: bool,
equal_average: bool,
},
DuplicateValues,
UniqueValues,
ContainsText {
operator: TextComparisonOperator,
text: String,
},
}Expand description
A conditional formatting rule’s condition — only cellIs (a direct value comparison) and
expression (an arbitrary custom formula) are modeled, CT_CfRule’s two simplest and most
common types.
Variants§
CellIs
type="cellIs": compares the cell’s own value against one or two formulas using a
relational operator (e.g. “greater than 0.5”, or “between 10 and 20” when formula2 is
set).
Fields
operator: ComparisonOperatorExpression
type="expression": an arbitrary formula, evaluated per cell in range, with the format
applied when it evaluates to TRUE.
ColorScale(Vec<ColorScaleStop>)
A 2- or 3-stop color scale (<colorScale>, CT_ColorScale). Unlike every other condition
variant, a color scale ignores ConditionalFormattingRule::format entirely (its coloring
comes from the stops themselves, not a dxf) — the writer never allocates a dxfId for
this variant, see writer.rs::write_conditional_formatting.
DataBar
A data bar (<dataBar>, CT_DataBar) — min/max stops plus a single fill color. Like
ColorScale, ignores format.
IconSet(IconSetType)
A 3-icon set (<iconSet>, CT_IconSet) using Excel’s own default equal-thirds percent
thresholds (0/33/67) — only the icon set’s visual style is configurable, not custom
thresholds (out of scope). Like ColorScale, ignores format.
Top10
type="top10": highlights the top (or bottom) rank items/percent of range.
Fields
AboveAverage
type="aboveAverage": highlights cells above (or below) the range’s average.
Fields
DuplicateValues
type="duplicateValues": highlights cells whose value appears more than once in range.
UniqueValues
type="uniqueValues": highlights cells whose value appears exactly once in range.
ContainsText
type="containsText"/"notContains"/"beginsWith"/"endsWith" (four distinct CT_CfRule
types sharing the same shape, see TextComparisonOperator): highlights cells whose text
matches text per operator. Unlike ConditionalFormattingCondition::CellIs, Excel
auto-generates the underlying formula from text and the range’s first cell — this crate
reproduces that (see writer.rs::write_conditional_formatting), it isn’t the caller’s
formula to write.
Trait Implementations§
Source§impl Clone for ConditionalFormattingCondition
impl Clone for ConditionalFormattingCondition
Source§fn clone(&self) -> ConditionalFormattingCondition
fn clone(&self) -> ConditionalFormattingCondition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more