Skip to main content

ConditionalFormattingManager

Struct ConditionalFormattingManager 

Source
pub struct ConditionalFormattingManager {
    pub data: HashMap<SheetId, Vector<CfBlock>>,
    /* private fields */
}

Fields§

§data: HashMap<SheetId, Vector<CfBlock>>

Per-sheet <conditionalFormatting> elements, in file order. Order is not significant to Excel (rules carry an explicit priority) but it is preserved anyway to keep save output stable.

Implementations§

Source§

impl ConditionalFormattingManager

Source

pub fn new() -> Self

Source

pub fn set_sheet(&mut self, sheet_id: SheetId, blocks: Vector<CfBlock>)

Source

pub fn get_sheet(&self, sheet_id: SheetId) -> Option<&Vector<CfBlock>>

Source

pub fn is_empty(&self) -> bool

Source

pub fn mint_rule_id(&mut self) -> u32

Mint a fresh rule id.

Source

pub fn max_priority(&self, sheet_id: SheetId) -> i32

The highest priority in use on a sheet. New rules go one past it, so they apply last — matching what Excel does when you add a rule.

Source

pub fn add_rule( &mut self, sheet_id: SheetId, ranges: Vector<CfRange>, rule: CtCfRule, ) -> u32

Add a rule as its own <conditionalFormatting> element covering ranges. Returns the new rule’s id.

A separate element per rule rather than merging into an existing one with the same ranges: Excel accepts either, and keeping them separate means a later delete never has to split an element apart.

Source

pub fn remove_rule(&mut self, id: u32) -> bool

Drop the rule with id. Elements left with no rules are removed, and a sheet left with no elements drops out of the map entirely so is_empty stays meaningful. Returns whether anything changed.

Source

pub fn replace_rule(&mut self, id: u32, rule: CtCfRule) -> bool

Swap in a new body for the rule with id, keeping its id and the ranges of the element it lives in. Returns whether the rule was found.

Source

pub fn set_rule_ranges(&mut self, id: u32, ranges: Vector<CfRange>) -> bool

Replace the ranges of the element owning id. Returns whether found.

Trait Implementations§

Source§

impl Clone for ConditionalFormattingManager

Source§

fn clone(&self) -> Self

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 ConditionalFormattingManager

Source§

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

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

impl Default for ConditionalFormattingManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more