Struct Style

Source
pub struct Style { /* private fields */ }
Expand description

§Examples

§add border

Result Image

use umya_spreadsheet::*;
let mut book = new_file();
let mut style = book.get_sheet_by_name_mut("Sheet1").unwrap().get_style_mut("D2");

// add bottom border
style.get_borders_mut().get_bottom_mut().set_border_style(Border::BORDER_MEDIUM);
// add top border
style.get_borders_mut().get_top_mut().set_border_style(Border::BORDER_MEDIUM);
// add left border
style.get_borders_mut().get_left_mut().set_border_style(Border::BORDER_MEDIUM);
// add right border
style.get_borders_mut().get_right_mut().set_border_style(Border::BORDER_MEDIUM);

§change cell color

Result Image

use umya_spreadsheet::*;

let mut book = new_file();
let mut style = book.get_sheet_by_name_mut("Sheet1").unwrap().get_style_mut("A1");

// fill color on red.
style.set_background_color(Color::COLOR_RED);

§change font color

Result Image

use umya_spreadsheet::*;

let mut book = new_file();
let mut style = book.get_sheet_by_name_mut("Sheet1").unwrap().get_style_mut("A1");

// font color on red.
style.get_font_mut().get_color_mut().set_argb(Color::COLOR_RED);

Implementations§

Source§

impl Style

Source

pub fn get_font(&self) -> Option<&Font>

Source

pub fn get_font_mut(&mut self) -> &mut Font

Source

pub fn set_font(&mut self, value: Font) -> &mut Self

Source

pub fn remove_font(&mut self) -> &mut Self

Source

pub fn get_fill(&self) -> Option<&Fill>

Source

pub fn get_fill_mut(&mut self) -> &mut Fill

Source

pub fn set_fill(&mut self, value: Fill) -> &mut Self

Source

pub fn get_background_color(&self) -> Option<&Color>

Source

pub fn set_background_color<S: Into<String>>(&mut self, color: S) -> &mut Self

Source

pub fn set_background_color_solid<S: Into<String>>( &mut self, color: S, ) -> &mut Self

Source

pub fn set_background_color_with_pattern<S: Into<String>>( &mut self, color1: S, color2: S, pattern: PatternValues, ) -> &mut Self

Source

pub fn remove_fill(&mut self) -> &mut Self

Source

pub fn get_borders(&self) -> Option<&Borders>

Source

pub fn get_borders_mut(&mut self) -> &mut Borders

Source

pub fn set_borders(&mut self, value: Borders) -> &mut Self

Source

pub fn remove_borders(&mut self) -> &mut Self

Source

pub fn get_alignment(&self) -> Option<&Alignment>

Source

pub fn get_alignment_mut(&mut self) -> &mut Alignment

Source

pub fn set_alignment(&mut self, value: Alignment) -> &mut Self

Source

pub fn remove_alignment(&mut self) -> &mut Self

Source

pub fn get_numbering_format(&self) -> Option<&NumberingFormat>

Source

pub fn get_numbering_format_mut(&mut self) -> &mut NumberingFormat

Source

pub fn set_numbering_format(&mut self, value: NumberingFormat) -> &mut Self

Source

pub fn remove_numbering_format(&mut self) -> &mut Self

Source

pub fn get_number_format(&self) -> Option<&NumberingFormat>

Source

pub fn get_number_format_mut(&mut self) -> &mut NumberingFormat

Source

pub fn set_number_format(&mut self, value: NumberingFormat) -> &mut Self

Source

pub fn remove_number_format(&mut self) -> &mut Self

Source

pub fn get_format_id(&self) -> &u32

Source

pub fn set_format_id(&mut self, value: u32) -> &mut Self

Source

pub fn get_protection(&self) -> Option<&Protection>

Source

pub fn get_protection_mut(&mut self) -> &mut Protection

Source

pub fn set_protection(&mut self, value: Protection) -> &mut Self

Source

pub fn remove_protection(&mut self) -> &mut Self

Source

pub fn get_default_value() -> Self

Trait Implementations§

Source§

impl Clone for Style

Source§

fn clone(&self) -> Style

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Style

Source§

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

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

impl Default for Style

Source§

fn default() -> Style

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

impl PartialEq for Style

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Style

Source§

fn partial_cmp(&self, other: &Style) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl StructuralPartialEq for Style

Auto Trait Implementations§

§

impl Freeze for Style

§

impl RefUnwindSafe for Style

§

impl Send for Style

§

impl Sync for Style

§

impl Unpin for Style

§

impl UnwindSafe for Style

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.