Skip to main content

ConditionalFormattingCondition

Enum ConditionalFormattingCondition 

Source
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

§formula1: String

The first (or only) comparison value/formula.

§formula2: Option<String>

The second comparison value/formula — only meaningful (and required by Excel) for Between/NotBetween.

§

Expression

type="expression": an arbitrary formula, evaluated per cell in range, with the format applied when it evaluates to TRUE.

Fields

§formula: String

The formula text (e.g. "MOD(ROW(),2)=0" for zebra striping).

§

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

§rank: u32
§percent: bool

Whether rank is a percentage rather than a raw count.

§bottom: bool

Highlights the bottom rank instead of the top.

§

AboveAverage

type="aboveAverage": highlights cells above (or below) the range’s average.

Fields

§above: bool

Highlights above-average cells (true) or below-average ones (false).

§equal_average: bool

Also highlights cells exactly equal to the average.

§

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.

Fields

§text: String

Trait Implementations§

Source§

impl Clone for ConditionalFormattingCondition

Source§

fn clone(&self) -> ConditionalFormattingCondition

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ConditionalFormattingCondition

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ConditionalFormattingCondition

Source§

fn eq(&self, other: &ConditionalFormattingCondition) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for ConditionalFormattingCondition

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.