pub struct WorkBook { /* private fields */ }
Expand description

Book is the main structure for the Spreadsheet.

Implementations§

source§

impl WorkBook

source

pub fn new_empty() -> Self

Creates a new, completely empty workbook.

WorkBook::locale_settings can be used to initialize default styles.

source

pub fn new(locale: Locale) -> Self

Creates a new workbook, and initializes default styles according to the given locale.

If the locale is not supported no ValueFormat’s are set and all depends on the application opening the spreadsheet.

The available locales can be activated via feature-flags.

source

pub fn locale_settings(&mut self, locale: Locale)

Creates a set of default formats and styles for every value-type.

If the locale is not supported no ValueFormat’s are set and all depends on the application opening the spreadsheet.

The available locales can be activated via feature-flags.

source

pub fn version(&self) -> &String

ODS version. Defaults to 1.3.

source

pub fn set_version(&mut self, version: String)

ODS version. Defaults to 1.3. It’s not advised to set another value.

source

pub fn config(&self) -> &WorkBookConfig

Configuration flags.

source

pub fn config_mut(&mut self) -> &mut WorkBookConfig

Configuration flags.

source

pub fn num_sheets(&self) -> usize

Number of sheets.

source

pub fn sheet_idx<S: AsRef<str>>(&self, name: S) -> Option<usize>

Finds the sheet index by the sheet-name.

source

pub fn detach_sheet(&mut self, n: usize) -> Detached<usize, Sheet>

Detaches a sheet. Useful if you have to make mutating calls to the workbook and the sheet intermixed.

Warning

The sheet has to be re-attached before saving the workbook.

Panics

Panics if the sheet has already been detached. Panics if n is out of bounds.

source

pub fn attach_sheet(&mut self, sheet: Detached<usize, Sheet>)

Reattaches the sheet in the place it was before.

Panics

Panics if n is out of bounds.

source

pub fn sheet(&self, n: usize) -> &Sheet

Returns a certain sheet.

Panics

Panics if n is out of bounds.

source

pub fn sheet_mut(&mut self, n: usize) -> &mut Sheet

Returns a certain sheet.

Panics

Panics if n does not exist.

source

pub fn iter_sheets(&self) -> impl Iterator<Item = &Sheet>

Returns iterator over sheets.

source

pub fn insert_sheet(&mut self, i: usize, sheet: Sheet)

Inserts the sheet at the given position.

source

pub fn push_sheet(&mut self, sheet: Sheet)

Appends a sheet.

source

pub fn remove_sheet(&mut self, n: usize) -> Sheet

Removes a sheet from the table.

Panics

Panics if the sheet was detached.

source

pub fn add_script(&mut self, v: Script)

Scripts.

source

pub fn iter_scripts(&self) -> impl Iterator<Item = &Script>

Scripts.

source

pub fn scripts(&self) -> &Vec<Script>

Scripts

source

pub fn scripts_mut(&mut self) -> &mut Vec<Script>

Scripts

source

pub fn add_event_listener(&mut self, e: EventListener)

Event-Listener

source

pub fn remove_event_listener( &mut self, event_name: &str ) -> Option<EventListener>

Event-Listener

source

pub fn iter_event_listeners(&self) -> impl Iterator<Item = &EventListener>

Event-Listener

source

pub fn event_listener(&self, event_name: &str) -> Option<&EventListener>

Event-Listener

source

pub fn event_listener_mut( &mut self, event_name: &str ) -> Option<&mut EventListener>

Event-Listener

source

pub fn add_def_style(&mut self, value_type: ValueType, style: CellStyleRef)

Adds a default-style for all new values. This information is only used when writing the data to the ODS file.

source

pub fn def_style(&self, value_type: ValueType) -> Option<&CellStyleRef>

Returns the default style name.

source

pub fn add_font(&mut self, font: FontFaceDecl)

Adds a font.

source

pub fn remove_font(&mut self, name: &str) -> Option<FontFaceDecl>

Removes a font.

source

pub fn iter_fonts(&self) -> impl Iterator<Item = &FontFaceDecl>

Iterates the fonts.

source

pub fn font(&self, name: &str) -> Option<&FontFaceDecl>

Returns the FontDecl.

source

pub fn font_mut(&mut self, name: &str) -> Option<&mut FontFaceDecl>

Returns a mutable FontDecl.

source

pub fn add_tablestyle(&mut self, style: TableStyle) -> TableStyleRef

Adds a style. Unnamed styles will be assigned an automatic name.

source

pub fn remove_tablestyle<S: AsRef<str>>( &mut self, name: S ) -> Option<TableStyle>

Removes a style.

source

pub fn iter_table_styles(&self) -> impl Iterator<Item = &TableStyle>

Iterates the table-styles.

source

pub fn tablestyle<S: AsRef<str>>(&self, name: S) -> Option<&TableStyle>

Returns the style.

source

pub fn tablestyle_mut<S: AsRef<str>>( &mut self, name: S ) -> Option<&mut TableStyle>

Returns the mutable style.

source

pub fn add_rowstyle(&mut self, style: RowStyle) -> RowStyleRef

Adds a style. Unnamed styles will be assigned an automatic name.

source

pub fn remove_rowstyle<S: AsRef<str>>(&mut self, name: S) -> Option<RowStyle>

Removes a style.

source

pub fn rowstyle<S: AsRef<str>>(&self, name: S) -> Option<&RowStyle>

Returns the style.

source

pub fn rowstyle_mut<S: AsRef<str>>(&mut self, name: S) -> Option<&mut RowStyle>

Returns the mutable style.

source

pub fn iter_rowstyles(&self) -> impl Iterator<Item = &RowStyle>

Returns iterator over styles.

source

pub fn add_colstyle(&mut self, style: ColStyle) -> ColStyleRef

Adds a style. Unnamed styles will be assigned an automatic name.

source

pub fn remove_colstyle<S: AsRef<str>>(&mut self, name: S) -> Option<ColStyle>

Removes a style.

source

pub fn colstyle<S: AsRef<str>>(&self, name: S) -> Option<&ColStyle>

Returns the style.

source

pub fn colstyle_mut<S: AsRef<str>>(&mut self, name: S) -> Option<&mut ColStyle>

Returns the mutable style.

source

pub fn iter_colstyles(&self) -> impl Iterator<Item = &ColStyle>

Returns iterator over styles.

source

pub fn add_cellstyle(&mut self, style: CellStyle) -> CellStyleRef

Adds a style. Unnamed styles will be assigned an automatic name.

source

pub fn remove_cellstyle<S: AsRef<str>>(&mut self, name: S) -> Option<CellStyle>

Removes a style.

source

pub fn iter_cellstyles(&self) -> impl Iterator<Item = &CellStyle>

Returns iterator over styles.

source

pub fn cellstyle<S: AsRef<str>>(&self, name: S) -> Option<&CellStyle>

Returns the style.

source

pub fn cellstyle_mut<S: AsRef<str>>( &mut self, name: S ) -> Option<&mut CellStyle>

Returns the mutable style.

source

pub fn add_paragraphstyle(&mut self, style: ParagraphStyle) -> ParagraphStyleRef

Adds a style. Unnamed styles will be assigned an automatic name.

source

pub fn remove_paragraphstyle<S: AsRef<str>>( &mut self, name: S ) -> Option<ParagraphStyle>

Removes a style.

source

pub fn iter_paragraphstyles(&self) -> impl Iterator<Item = &ParagraphStyle>

Returns iterator over styles.

source

pub fn paragraphstyle<S: AsRef<str>>(&self, name: S) -> Option<&ParagraphStyle>

Returns the style.

source

pub fn paragraphstyle_mut<S: AsRef<str>>( &mut self, name: S ) -> Option<&mut ParagraphStyle>

Returns the mutable style.

source

pub fn add_textstyle(&mut self, style: TextStyle) -> TextStyleRef

Adds a style. Unnamed styles will be assigned an automatic name.

source

pub fn remove_textstyle<S: AsRef<str>>(&mut self, name: S) -> Option<TextStyle>

Removes a style.

source

pub fn iter_textstyles(&self) -> impl Iterator<Item = &TextStyle>

Returns iterator over styles.

source

pub fn textstyle<S: AsRef<str>>(&self, name: S) -> Option<&TextStyle>

Returns the style.

source

pub fn textstyle_mut<S: AsRef<str>>( &mut self, name: S ) -> Option<&mut TextStyle>

Returns the mutable style.

source

pub fn add_rubystyle(&mut self, style: RubyStyle) -> RubyStyleRef

Adds a style. Unnamed styles will be assigned an automatic name.

source

pub fn remove_rubystyle<S: AsRef<str>>(&mut self, name: S) -> Option<RubyStyle>

Removes a style.

source

pub fn iter_rubystyles(&self) -> impl Iterator<Item = &RubyStyle>

Returns iterator over styles.

source

pub fn rubystyle<S: AsRef<str>>(&self, name: S) -> Option<&RubyStyle>

Returns the style.

source

pub fn rubystyle_mut<S: AsRef<str>>( &mut self, name: S ) -> Option<&mut RubyStyle>

Returns the mutable style.

source

pub fn add_graphicstyle(&mut self, style: GraphicStyle) -> GraphicStyleRef

Adds a style. Unnamed styles will be assigned an automatic name.

source

pub fn remove_graphicstyle<S: AsRef<str>>( &mut self, name: S ) -> Option<GraphicStyle>

Removes a style.

source

pub fn iter_graphicstyles(&self) -> impl Iterator<Item = &GraphicStyle>

Returns iterator over styles.

source

pub fn graphicstyle<S: AsRef<str>>(&self, name: S) -> Option<&GraphicStyle>

Returns the style.

source

pub fn graphicstyle_mut<S: AsRef<str>>( &mut self, name: S ) -> Option<&mut GraphicStyle>

Returns the mutable style.

source

pub fn add_boolean_format( &mut self, vstyle: ValueFormatBoolean ) -> ValueFormatRef

Adds a value format. Unnamed formats will be assigned an automatic name.

source

pub fn remove_boolean_format( &mut self, name: &str ) -> Option<ValueFormatBoolean>

Removes the format.

source

pub fn iter_boolean_formats(&self) -> impl Iterator<Item = &ValueFormatBoolean>

Returns iterator over formats.

source

pub fn boolean_format(&self, name: &str) -> Option<&ValueFormatBoolean>

Returns the format.

source

pub fn boolean_format_mut( &mut self, name: &str ) -> Option<&mut ValueFormatBoolean>

Returns the mutable format.

source

pub fn add_number_format(&mut self, vstyle: ValueFormatNumber) -> ValueFormatRef

Adds a value format. Unnamed formats will be assigned an automatic name.

source

pub fn remove_number_format(&mut self, name: &str) -> Option<ValueFormatNumber>

Removes the format.

source

pub fn iter_number_formats(&self) -> impl Iterator<Item = &ValueFormatNumber>

Returns iterator over formats.

source

pub fn number_format(&self, name: &str) -> Option<&ValueFormatBoolean>

Returns the format.

source

pub fn number_format_mut( &mut self, name: &str ) -> Option<&mut ValueFormatBoolean>

Returns the mutable format.

source

pub fn add_percentage_format( &mut self, vstyle: ValueFormatPercentage ) -> ValueFormatRef

Adds a value format. Unnamed formats will be assigned an automatic name.

source

pub fn remove_percentage_format( &mut self, name: &str ) -> Option<ValueFormatPercentage>

Removes the format.

source

pub fn iter_percentage_formats( &self ) -> impl Iterator<Item = &ValueFormatPercentage>

Returns iterator over formats.

source

pub fn percentage_format(&self, name: &str) -> Option<&ValueFormatPercentage>

Returns the format.

source

pub fn percentage_format_mut( &mut self, name: &str ) -> Option<&mut ValueFormatPercentage>

Returns the mutable format.

source

pub fn add_currency_format( &mut self, vstyle: ValueFormatCurrency ) -> ValueFormatRef

Adds a value format. Unnamed formats will be assigned an automatic name.

source

pub fn remove_currency_format( &mut self, name: &str ) -> Option<ValueFormatCurrency>

Removes the format.

source

pub fn iter_currency_formats( &self ) -> impl Iterator<Item = &ValueFormatCurrency>

Returns iterator over formats.

source

pub fn currency_format(&self, name: &str) -> Option<&ValueFormatCurrency>

Returns the format.

source

pub fn currency_format_mut( &mut self, name: &str ) -> Option<&mut ValueFormatCurrency>

Returns the mutable format.

source

pub fn add_text_format(&mut self, vstyle: ValueFormatText) -> ValueFormatRef

Adds a value format. Unnamed formats will be assigned an automatic name.

source

pub fn remove_text_format(&mut self, name: &str) -> Option<ValueFormatText>

Removes the format.

source

pub fn iter_text_formats(&self) -> impl Iterator<Item = &ValueFormatText>

Returns iterator over formats.

source

pub fn text_format(&self, name: &str) -> Option<&ValueFormatText>

Returns the format.

source

pub fn text_format_mut(&mut self, name: &str) -> Option<&mut ValueFormatText>

Returns the mutable format.

source

pub fn add_datetime_format( &mut self, vstyle: ValueFormatDateTime ) -> ValueFormatRef

Adds a value format. Unnamed formats will be assigned an automatic name.

source

pub fn remove_datetime_format( &mut self, name: &str ) -> Option<ValueFormatDateTime>

Removes the format.

source

pub fn iter_datetime_formats( &self ) -> impl Iterator<Item = &ValueFormatDateTime>

Returns iterator over formats.

source

pub fn datetime_format(&self, name: &str) -> Option<&ValueFormatDateTime>

Returns the format.

source

pub fn datetime_format_mut( &mut self, name: &str ) -> Option<&mut ValueFormatDateTime>

Returns the mutable format.

source

pub fn add_timeduration_format( &mut self, vstyle: ValueFormatTimeDuration ) -> ValueFormatRef

Adds a value format. Unnamed formats will be assigned an automatic name.

source

pub fn remove_timeduration_format( &mut self, name: &str ) -> Option<ValueFormatTimeDuration>

Removes the format.

source

pub fn iter_timeduration_formats( &self ) -> impl Iterator<Item = &ValueFormatTimeDuration>

Returns iterator over formats.

source

pub fn timeduration_format( &self, name: &str ) -> Option<&ValueFormatTimeDuration>

Returns the format.

source

pub fn timeduration_format_mut( &mut self, name: &str ) -> Option<&mut ValueFormatTimeDuration>

Returns the mutable format.

source

pub fn add_pagestyle(&mut self, pstyle: PageStyle) -> PageStyleRef

Adds a value PageStyle. Unnamed formats will be assigned an automatic name.

source

pub fn remove_pagestyle<S: AsRef<str>>(&mut self, name: S) -> Option<PageStyle>

Removes the PageStyle.

source

pub fn iter_pagestyles(&self) -> impl Iterator<Item = &PageStyle>

Returns iterator over formats.

source

pub fn pagestyle<S: AsRef<str>>(&self, name: S) -> Option<&PageStyle>

Returns the PageStyle.

source

pub fn pagestyle_mut<S: AsRef<str>>( &mut self, name: S ) -> Option<&mut PageStyle>

Returns the mutable PageStyle.

source

pub fn add_masterpage(&mut self, mpage: MasterPage) -> MasterPageRef

Adds a value MasterPage. Unnamed formats will be assigned an automatic name.

source

pub fn remove_masterpage<S: AsRef<str>>( &mut self, name: S ) -> Option<MasterPage>

Removes the MasterPage.

source

pub fn iter_masterpages(&self) -> impl Iterator<Item = &MasterPage>

Returns iterator over formats.

source

pub fn masterpage<S: AsRef<str>>(&self, name: S) -> Option<&MasterPage>

Returns the MasterPage.

source

pub fn masterpage_mut<S: AsRef<str>>( &mut self, name: S ) -> Option<&mut MasterPage>

Returns the mutable MasterPage.

source

pub fn add_validation(&mut self, valid: Validation) -> ValidationRef

Adds a Validation. Nameless validations will be assigned a name.

source

pub fn remove_validation<S: AsRef<str>>( &mut self, name: S ) -> Option<Validation>

Removes a Validation.

source

pub fn iter_validations(&self) -> impl Iterator<Item = &Validation>

Returns iterator over formats.

source

pub fn validation<S: AsRef<str>>(&self, name: S) -> Option<&Validation>

Returns the Validation.

source

pub fn validation_mut<S: AsRef<str>>( &mut self, name: S ) -> Option<&mut Validation>

Returns a mutable Validation.

source

pub fn add_manifest(&mut self, manifest: Manifest)

Adds a manifest entry, replaces an existing one with the same name.

source

pub fn remove_manifest(&mut self, path: &str) -> Option<Manifest>

Removes a manifest entry.

source

pub fn iter_manifest(&self) -> impl Iterator<Item = &Manifest>

Iterates the manifest.

source

pub fn manifest(&self, path: &str) -> Option<&Manifest>

Returns the manifest entry for the path

source

pub fn manifest_mut(&mut self, path: &str) -> Option<&mut Manifest>

Returns the manifest entry for the path

source

pub fn metadata(&self) -> &Metadata

Gives access to meta-data.

source

pub fn metadata_mut(&mut self) -> &mut Metadata

Gives access to meta-data.

Trait Implementations§

source§

impl Clone for WorkBook

source§

fn clone(&self) -> WorkBook

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 WorkBook

source§

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

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

impl Default for WorkBook

source§

fn default() -> Self

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

impl GetSize for WorkBook

source§

fn get_heap_size(&self) -> usize

Determines how many bytes this object occupies inside the heap. Read more
source§

fn get_stack_size() -> usize

Determines how may bytes this object occupies inside the stack. Read more
source§

fn get_size(&self) -> usize

Determines the total size of the object. 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> ToOwned for T
where T: Clone,

§

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

§

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

§

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.