[][src]Struct spreadsheet_ods::style::Style

pub struct Style { /* fields omitted */ }

Styles define a large number of attributes. These are grouped together as table, row, column, cell, paragraph and text attributes.

use spreadsheet_ods::{Style, CellRef, WorkBook};
use spreadsheet_ods::style::{StyleOrigin, StyleUse, AttrText, StyleMap};
use color::Rgb;

let mut wb = WorkBook::new();

let mut st = Style::new_cell_style("ce12", "num2");
st.text_mut().set_color(Rgb::new(192, 128, 0));
st.text_mut().set_font_bold();
wb.add_style(st);

let mut st = Style::new_cell_style("ce11", "num2");
st.text_mut().set_color(Rgb::new(0, 192, 128));
st.text_mut().set_font_bold();
wb.add_style(st);

let mut st = Style::new_cell_style("ce13", "num4");
st.push_stylemap(StyleMap::new("cell-content()=\"BB\"", "ce12", CellRef::remote("sheet0", 4, 3)));
st.push_stylemap(StyleMap::new("cell-content()=\"CC\"", "ce11", CellRef::remote("sheet0", 4, 3)));
wb.add_style(st);

Styles can be defined in content.xml or as global styles in styles.xml. This is reflected as the StyleOrigin. The StyleUse differentiates between automatic and user visible, named styles. And third StyleFor defines for which part of the document the style can be used.

Cell styles usually reference a value format for text formatting purposes.

Styles can also link to a parent style and to a pagelayout.

Implementations

impl Style[src]

pub fn new() -> Self[src]

New, empty.

pub fn new_cell_style<S: Into<String>, T: Into<String>>(
    name: S,
    value_style: T
) -> Self
[src]

Creates a new cell style. value_style references a ValueFormat.

pub fn new_col_style<S: Into<String>, T: Into<String>>(
    name: S,
    value_style: T
) -> Self
[src]

Creates a new column style. value_style references a ValueFormat.

pub fn new_row_style<S: Into<String>, T: Into<String>>(
    name: S,
    value_style: T
) -> Self
[src]

Creates a new row style. value_style references a ValueFormat.

pub fn new_table_style<S: Into<String>, T: Into<String>>(
    name: S,
    value_style: T
) -> Self
[src]

Creates a new table style. value_style references a ValueFormat.

pub fn new_with_name<S: Into<String>, T: Into<String>>(
    family: StyleFor,
    name: S,
    value_style: T
) -> Self
[src]

New, with name. value_style references a ValueFormat.

pub fn set_name<S: Into<String>>(&mut self, name: S)[src]

Sets the name.

pub fn name(&self) -> &String[src]

Returns the name.

pub fn set_display_name<S: Into<String>>(&mut self, name: S)[src]

Sets the display name.

pub fn display_name(&self) -> Option<&String>[src]

Returns the display name.

pub fn set_origin(&mut self, origin: StyleOrigin)[src]

Sets the origin.

pub fn origin(&self) -> StyleOrigin[src]

Returns the origin.

pub fn set_styleuse(&mut self, styleuse: StyleUse)[src]

Style usage.

pub fn styleuse(&self) -> StyleUse[src]

Returns the usage.

pub fn set_family(&mut self, family: StyleFor)[src]

Sets the style-family.

pub fn family(&self) -> StyleFor[src]

Returns the style-family.

pub fn set_parent<S: Into<String>>(&mut self, parent: S)[src]

Sets the parent style.

pub fn parent(&self) -> Option<&String>[src]

Returns the parent style.

pub fn set_value_format<S: Into<String>>(&mut self, value_format: S)[src]

Sets the value format.

pub fn value_format(&self) -> Option<&String>[src]

Returns the value format.

pub fn set_master_page_name<S: Into<String>>(&mut self, value_format: S)[src]

Sets the value format.

pub fn master_page_name(&self) -> Option<&String>[src]

Returns the value format.

pub fn table(&self) -> &TableAttr[src]

Table style attributes.

Panic

Only accessible when family() == StyleFor::Table.

pub fn table_mut(&mut self) -> &mut TableAttr[src]

Table style attributes.

Panic

Only accessible when family() == StyleFor::Table.

pub fn col(&self) -> &TableColAttr[src]

Table column style attributes.

Panic

Only accessible when family() == StyleFor::TableColumn.

pub fn col_mut(&mut self) -> &mut TableColAttr[src]

Table column style attributes.

Panic

Only accessible when family() == StyleFor::TableColumn.

pub fn row(&self) -> &TableRowAttr[src]

Table-row style attributes.

Panic

Only accessible when family() == StyleFor::TableRow.

pub fn row_mut(&mut self) -> &mut TableRowAttr[src]

Table-row style attributes.

Panic

Only accessible when family() == StyleFor::TableRow.

pub fn cell(&self) -> &TableCellAttr[src]

Table-cell style attributes.

Panic

Only accessible when family() == StyleFor::TableCell.

pub fn cell_mut(&mut self) -> &mut TableCellAttr[src]

Table-cell style attributes.

Panic

Only accessible when family() == StyleFor::TableCell.

pub fn paragraph(&self) -> &ParagraphAttr[src]

Paragraph style attributes.

pub fn paragraph_mut(&mut self) -> &mut ParagraphAttr[src]

Paragraph style attributes.

pub fn graphic(&self) -> &GraphicAttr[src]

Graphic style attributes.

pub fn graphic_mut(&mut self) -> &mut GraphicAttr[src]

Graphic style attributes.

pub fn text(&self) -> &TextAttr[src]

Text style attributes.

pub fn text_mut(&mut self) -> &mut TextAttr[src]

Text style attributes.

pub fn push_stylemap(&mut self, stylemap: StyleMap)[src]

Adds a stylemap.

pub fn stylemaps(&self) -> Option<&Vec<StyleMap>>[src]

Returns the stylemaps

pub fn stylemaps_mut(&mut self) -> &mut Vec<StyleMap>[src]

Returns the mutable stylemap.

Trait Implementations

impl Clone for Style[src]

impl Debug for Style[src]

impl Default for Style[src]

Auto Trait Implementations

impl RefUnwindSafe for Style

impl Send for Style

impl Sync for Style

impl Unpin for Style

impl UnwindSafe for Style

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.