Struct spreadsheet_ods::condition::ValueCondition
source · pub struct ValueCondition { /* private fields */ }Expand description
Defines a condition that compares the cell-content with a value.
Implementations§
source§impl ValueCondition
impl ValueCondition
sourcepub fn value_eq<V: Into<Value>>(value: V) -> ValueCondition
pub fn value_eq<V: Into<Value>>(value: V) -> ValueCondition
Compares the cell-content with a value.
sourcepub fn value_ne<V: Into<Value>>(value: V) -> ValueCondition
pub fn value_ne<V: Into<Value>>(value: V) -> ValueCondition
Compares the cell-content with a value.
sourcepub fn value_lt<V: Into<Value>>(value: V) -> ValueCondition
pub fn value_lt<V: Into<Value>>(value: V) -> ValueCondition
Compares the cell-content with a value.
sourcepub fn value_gt<V: Into<Value>>(value: V) -> ValueCondition
pub fn value_gt<V: Into<Value>>(value: V) -> ValueCondition
Compares the cell-content with a value.
sourcepub fn value_le<V: Into<Value>>(value: V) -> ValueCondition
pub fn value_le<V: Into<Value>>(value: V) -> ValueCondition
Compares the cell-content with a value.
sourcepub fn value_ge<V: Into<Value>>(value: V) -> ValueCondition
pub fn value_ge<V: Into<Value>>(value: V) -> ValueCondition
Compares the cell-content with a value.
Examples found in repository?
examples/negative_number_red.rs (line 30)
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
pub fn main() -> Result<(), OdsError> {
let mut wb = WorkBook::new(locale!("de_AT"));
// positive format
let mut f_number = ValueFormatNumber::new_localized("num0", locale!("de_AT"));
f_number
.part_number()
.decimal_places(2)
.min_integer_digits(1)
.grouping()
.build();
let f_number = wb.add_number_format(f_number);
// negative format
let mut f_number_red = ValueFormatNumber::new_localized("num0red", locale!("de_AT"));
f_number_red.part_text("-").build();
f_number_red
.part_number()
.decimal_places(2)
.min_integer_digits(1)
.grouping()
.build();
f_number_red.set_color(Rgb::new(255, 0, 0));
f_number_red.push_stylemap(ValueStyleMap::new(ValueCondition::value_ge(0), f_number));
let f_number_red = wb.add_number_format(f_number_red);
// cellstyle for this number format
let s_number = CellStyle::new("num_red", &f_number_red);
let s_number = wb.add_cellstyle(s_number);
// ...
let mut sheet = Sheet::new("sample");
sheet.set_styled_value(0, 0, 723, &s_number);
sheet.set_styled_value(1, 0, -723, &s_number);
wb.push_sheet(sheet);
write_ods(&mut wb, "examples/neg.ods")?;
Ok(())
}Trait Implementations§
source§impl Clone for ValueCondition
impl Clone for ValueCondition
source§fn clone(&self) -> ValueCondition
fn clone(&self) -> ValueCondition
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for ValueCondition
impl Debug for ValueCondition
Auto Trait Implementations§
impl RefUnwindSafe for ValueCondition
impl Send for ValueCondition
impl Sync for ValueCondition
impl Unpin for ValueCondition
impl UnwindSafe for ValueCondition
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
Mutably borrows from an owned value. Read more