Skip to main content

StyleBuilder

Struct StyleBuilder 

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

Builder for creating Style objects with a fluent API.

Each setter method initializes the relevant sub-struct if it has not been set yet, then applies the value. Call build() to obtain the final Style.

Implementations§

Source§

impl StyleBuilder

Source

pub fn new() -> Self

Create a new StyleBuilder with all fields set to None.

Source

pub fn bold(self, bold: bool) -> Self

Set the bold flag on the font.

Source

pub fn italic(self, italic: bool) -> Self

Set the italic flag on the font.

Source

pub fn underline(self, underline: bool) -> Self

Set the underline flag on the font.

Source

pub fn strikethrough(self, strikethrough: bool) -> Self

Set the strikethrough flag on the font.

Source

pub fn font_name(self, name: &str) -> Self

Set the font name (e.g. “Arial”, “Calibri”).

Source

pub fn font_size(self, size: f64) -> Self

Set the font size in points.

Source

pub fn font_color(self, color: StyleColor) -> Self

Set the font color using a StyleColor value.

Source

pub fn font_color_rgb(self, rgb: &str) -> Self

Set the font color using an ARGB hex string (e.g. “FF0000FF”).

Source

pub fn fill_pattern(self, pattern: PatternType) -> Self

Set the fill pattern type.

Source

pub fn fill_fg_color(self, color: StyleColor) -> Self

Set the fill foreground color.

Source

pub fn fill_fg_color_rgb(self, rgb: &str) -> Self

Set the fill foreground color using an ARGB hex string.

Source

pub fn fill_bg_color(self, color: StyleColor) -> Self

Set the fill background color.

Source

pub fn solid_fill(self, rgb: &str) -> Self

Convenience method: set a solid fill with the given ARGB foreground color.

Source

pub fn border_left(self, style: BorderLineStyle, color: StyleColor) -> Self

Set the left border style and color.

Source

pub fn border_right(self, style: BorderLineStyle, color: StyleColor) -> Self

Set the right border style and color.

Source

pub fn border_top(self, style: BorderLineStyle, color: StyleColor) -> Self

Set the top border style and color.

Source

pub fn border_bottom(self, style: BorderLineStyle, color: StyleColor) -> Self

Set the bottom border style and color.

Source

pub fn border_all(self, style: BorderLineStyle, color: StyleColor) -> Self

Set all four border sides (left, right, top, bottom) to the same style and color.

Source

pub fn horizontal_align(self, align: HorizontalAlign) -> Self

Set horizontal alignment.

Source

pub fn vertical_align(self, align: VerticalAlign) -> Self

Set vertical alignment.

Source

pub fn wrap_text(self, wrap: bool) -> Self

Set the wrap text flag.

Source

pub fn text_rotation(self, degrees: u32) -> Self

Set text rotation in degrees.

Source

pub fn indent(self, indent: u32) -> Self

Set the indent level.

Source

pub fn shrink_to_fit(self, shrink: bool) -> Self

Set the shrink to fit flag.

Source

pub fn num_format_builtin(self, id: u32) -> Self

Set a built-in number format by ID (see builtin_num_fmts constants).

Source

pub fn num_format_custom(self, format: &str) -> Self

Set a custom number format string (e.g. “#,##0.00”).

Source

pub fn locked(self, locked: bool) -> Self

Set the locked flag for cell protection.

Source

pub fn hidden(self, hidden: bool) -> Self

Set the hidden flag for cell protection.

Source

pub fn build(self) -> Style

Consume the builder and return the constructed Style.

Trait Implementations§

Source§

impl Default for StyleBuilder

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> 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, 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.