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
impl ConditionalFormattingManager
pub fn new() -> Self
pub fn set_sheet(&mut self, sheet_id: SheetId, blocks: Vector<CfBlock>)
pub fn get_sheet(&self, sheet_id: SheetId) -> Option<&Vector<CfBlock>>
pub fn is_empty(&self) -> bool
Sourcepub fn mint_rule_id(&mut self) -> u32
pub fn mint_rule_id(&mut self) -> u32
Mint a fresh rule id.
Sourcepub fn max_priority(&self, sheet_id: SheetId) -> i32
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.
Sourcepub fn add_rule(
&mut self,
sheet_id: SheetId,
ranges: Vector<CfRange>,
rule: CtCfRule,
) -> u32
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.
Sourcepub fn remove_rule(&mut self, id: u32) -> bool
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.
Sourcepub fn replace_rule(&mut self, id: u32, rule: CtCfRule) -> bool
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.
Trait Implementations§
Source§impl Clone for ConditionalFormattingManager
impl Clone for ConditionalFormattingManager
Source§impl Debug for ConditionalFormattingManager
impl Debug for ConditionalFormattingManager
Auto Trait Implementations§
impl Forget for ConditionalFormattingManager
impl Freeze for ConditionalFormattingManager
impl Move for ConditionalFormattingManager
impl RefUnwindSafe for ConditionalFormattingManager
impl Send for ConditionalFormattingManager
impl Sync for ConditionalFormattingManager
impl Unpin for ConditionalFormattingManager
impl UnsafeUnpin for ConditionalFormattingManager
impl UnwindSafe for ConditionalFormattingManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.