Struct spreadsheet_ods::Sheet

source ·
pub struct Sheet { /* private fields */ }
Expand description

One sheet of the spreadsheet.

Contains the data and the style-references. The can also be styles on the whole sheet, columns and rows. The more complicated grouping tags are not covered.

Implementations§

source§

impl Sheet

source

pub fn new_with_name<S: Into<String>>(name: S) -> Self

👎Deprecated

Create an empty sheet.

source

pub fn new<S: Into<String>>(name: S) -> Self

Create an empty sheet.

The name is shown as the tab-title, but also as a reference for this sheet in formulas and sheet-metadata. Giving an empty string here is allowed and a name will be generated, when the document is opened. But any metadata will not be applied.

Renaming the sheet works for metadata, but formulas will not be fixed.

source

pub fn clone_no_data(&self) -> Self

Copy all the attributes but not the actual data.

source

pub fn iter(&self) -> CellIter<'_>

Iterate all cells.

source

pub fn cell_count(&self) -> usize

Count all cells with any data.

source

pub fn iter_rows<R: RangeBounds<(u32, u32)>>( &self, range: R ) -> impl Iterator<Item = ((u32, u32), CellContentRef<'_>)>

Iterate the range row-wise.

If there is no upper bound this uses used_grid_size(), which does an extra full iteration to find the bounds.

source

pub fn iter_cols<R: RangeBounds<(u32, u32)>>( &self, range: R ) -> impl Iterator<Item = ((u32, u32), CellContentRef<'_>)>

Iterate the range column-wise.

If there is no upper bound this uses used_grid_size(), which does an extra full iteration to find the bounds.

source

pub fn range<R: RangeBounds<(u32, u32)>>( &self, range: R ) -> impl Iterator<Item = ((u32, u32), CellContentRef<'_>)>

Iterate a range of cells in lexical order.

source

pub fn set_name<V: Into<String>>(&mut self, name: V)

Sheet name.

source

pub fn name(&self) -> &String

Sheet name.

source

pub fn config(&self) -> &SheetConfig

Configuration for the sheet.

source

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

Configuration for the sheet.

source

pub fn set_style(&mut self, style: &TableStyleRef)

Sets the table-style

source

pub fn style(&self) -> Option<&TableStyleRef>

Returns the table-style.

source

pub fn set_colstyle(&mut self, col: u32, style: &ColStyleRef)

Column style.

source

pub fn clear_colstyle(&mut self, col: u32)

Remove the style.

source

pub fn colstyle(&self, col: u32) -> Option<&ColStyleRef>

Returns the column style.

source

pub fn set_col_cellstyle(&mut self, col: u32, style: &CellStyleRef)

Default cell style for this column.

source

pub fn clear_col_cellstyle(&mut self, col: u32)

Remove the style.

source

pub fn col_cellstyle(&self, col: u32) -> Option<&CellStyleRef>

Returns the default cell style for this column.

source

pub fn set_col_visible(&mut self, col: u32, visible: Visibility)

Visibility of the column

source

pub fn col_visible(&self, col: u32) -> Visibility

Returns the default cell style for this column.

source

pub fn _set_col_header_span(&mut self, col: u32, span: u32)

unstable internal method

source

pub fn _col_header_span(&self, col: u32) -> u32

unstable internal method

source

pub fn set_col_width(&mut self, col: u32, width: Length)

Sets the column width for this column.

source

pub fn col_width(&self, col: u32) -> Length

Returns the column-width.

source

pub fn _row_header_span(&self, row: u32) -> Option<u32>

unstable internal method.

source

pub fn _set_row_header_span(&mut self, row: u32, span: u32)

unstable internal method.

source

pub fn set_rowstyle(&mut self, row: u32, style: &RowStyleRef)

Row style.

source

pub fn clear_rowstyle(&mut self, row: u32)

Remove the style.

source

pub fn rowstyle(&self, row: u32) -> Option<&RowStyleRef>

Returns the row style.

source

pub fn set_row_cellstyle(&mut self, row: u32, style: &CellStyleRef)

Default cell style for this row.

source

pub fn clear_row_cellstyle(&mut self, row: u32)

Remove the style.

source

pub fn row_cellstyle(&self, row: u32) -> Option<&CellStyleRef>

Returns the default cell style for this row.

source

pub fn set_row_visible(&mut self, row: u32, visible: Visibility)

Visibility of the row

source

pub fn row_visible(&self, row: u32) -> Visibility

Returns the default cell style for this row.

source

pub fn set_row_repeat(&mut self, row: u32, repeat: u32)

Sets the repeat count for this row. Usually this is the last row with data in a sheet. Setting the repeat count will not change the row number of following rows. But they will be changed after writing to an ODS file and reading it again.

Panics

Panics if the repeat is 0.

source

pub fn row_repeat(&self, row: u32) -> u32

Returns the repeat count for this row.

source

pub fn set_row_height(&mut self, row: u32, height: Length)

Sets the row-height.

source

pub fn row_height(&self, row: u32) -> Length

Returns the row-height

source

pub fn _col_header_len(&self) -> usize

Returns the maximum used column in the column header.

source

pub fn _row_header_len(&self) -> usize

Returns the maximum used row in the row header.

source

pub fn col_header_max(&self) -> u32

Returns the maximum used column in the column header.

source

pub fn row_header_max(&self) -> u32

Returns the maximum used row in the row header.

source

pub fn used_grid_size(&self) -> (u32, u32)

Returns a tuple of (max(row)+1, max(col)+1)

source

pub fn set_display(&mut self, display: bool)

Is the sheet displayed?

source

pub fn display(&self) -> bool

Is the sheet displayed?

source

pub fn set_print(&mut self, print: bool)

Is the sheet printed?

source

pub fn print(&self) -> bool

Is the sheet printed?

source

pub fn is_empty(&self, row: u32, col: u32) -> bool

Returns true if there is no SCell at the given position.

source

pub fn cell(&self, row: u32, col: u32) -> Option<CellContent>

Returns a clone of the cell content.

source

pub fn cell_ref(&self, row: u32, col: u32) -> Option<CellContentRef<'_>>

Returns references to the cell data.

source

pub fn add_cell(&mut self, row: u32, col: u32, cell: CellContent)

Consumes the CellContent and sets the values.

source

pub fn remove_cell(&mut self, row: u32, col: u32) -> Option<CellContent>

Removes the cell and returns the values as CellContent.

source

pub fn set_styled<V: Into<Value>>( &mut self, row: u32, col: u32, value: V, style: &CellStyleRef )

Sets a value for the specified cell and provides a style at the same time.

source

pub fn set_styled_value<V: Into<Value>>( &mut self, row: u32, col: u32, value: V, style: &CellStyleRef )

Sets a value for the specified cell. Creates a new cell if necessary.

source

pub fn set_value<V: Into<Value>>(&mut self, row: u32, col: u32, value: V)

Sets a value for the specified cell. Creates a new cell if necessary.

source

pub fn value(&self, row: u32, col: u32) -> &Value

Returns a value

source

pub fn set_formula<V: Into<String>>(&mut self, row: u32, col: u32, formula: V)

Sets a formula for the specified cell. Creates a new cell if necessary.

source

pub fn clear_formula(&mut self, row: u32, col: u32)

Removes the formula.

source

pub fn formula(&self, row: u32, col: u32) -> Option<&String>

Returns a value

source

pub fn set_cell_repeat(&mut self, row: u32, col: u32, repeat: u32)

Sets a repeat counter for the cell.

source

pub fn cell_repeat(&self, row: u32, col: u32) -> u32

Returns the repeat counter for the cell within one row.

source

pub fn set_cellstyle(&mut self, row: u32, col: u32, style: &CellStyleRef)

Sets the cell-style for the specified cell. Creates a new cell if necessary.

source

pub fn clear_cellstyle(&mut self, row: u32, col: u32)

Removes the cell-style.

source

pub fn cellstyle(&self, row: u32, col: u32) -> Option<&CellStyleRef>

Returns a value

source

pub fn set_validation(&mut self, row: u32, col: u32, validation: &ValidationRef)

Sets a content-validation for this cell.

source

pub fn clear_validation(&mut self, row: u32, col: u32)

Removes the cell-style.

source

pub fn validation(&self, row: u32, col: u32) -> Option<&ValidationRef>

Returns a content-validation name for this cell.

source

pub fn set_row_span(&mut self, row: u32, col: u32, span: u32)

Sets the rowspan of the cell. Must be greater than 0.

source

pub fn row_span(&self, row: u32, col: u32) -> u32

Rowspan of the cell.

source

pub fn set_col_span(&mut self, row: u32, col: u32, span: u32)

Sets the colspan of the cell. Must be greater than 0.

source

pub fn col_span(&self, row: u32, col: u32) -> u32

Colspan of the cell.

source

pub fn set_matrix_row_span(&mut self, row: u32, col: u32, span: u32)

Sets the rowspan of the cell. Must be greater than 0.

source

pub fn matrix_row_span(&self, row: u32, col: u32) -> u32

Rowspan of the cell.

source

pub fn set_matrix_col_span(&mut self, row: u32, col: u32, span: u32)

Sets the colspan of the cell. Must be greater than 0.

source

pub fn matrix_col_span(&self, row: u32, col: u32) -> u32

Colspan of the cell.

source

pub fn set_annotation(&mut self, row: u32, col: u32, annotation: Annotation)

Sets a annotation for this cell.

source

pub fn clear_annotation(&mut self, row: u32, col: u32)

Removes the annotation.

source

pub fn annotation(&self, row: u32, col: u32) -> Option<&Annotation>

Returns a content-validation name for this cell.

source

pub fn annotation_mut(&mut self, row: u32, col: u32) -> Option<&mut Annotation>

Returns a content-validation name for this cell.

source

pub fn add_draw_frame(&mut self, row: u32, col: u32, draw_frame: DrawFrame)

Add a drawframe to a specific cell.

source

pub fn clear_draw_frames(&mut self, row: u32, col: u32)

Removes all drawframes.

source

pub fn draw_frames(&self, row: u32, col: u32) -> Option<&Vec<DrawFrame>>

Returns the draw-frames.

source

pub fn draw_frames_mut( &mut self, row: u32, col: u32 ) -> Option<&mut Vec<DrawFrame>>

Returns a content-validation name for this cell.

source

pub fn set_header_rows(&mut self, row_start: u32, row_end: u32)

Defines a range of rows as header rows. These rows are repeated when printing on multiple pages.

source

pub fn clear_header_rows(&mut self)

Clears the header-rows definition.

source

pub fn header_rows(&self) -> Option<Header>

Returns the header rows. These rows are repeated when printing on multiple pages.

source

pub fn set_header_cols(&mut self, col_start: u32, col_end: u32)

Defines a range of columns as header columns. These columns are repeated when printing on multiple pages.

source

pub fn clear_header_cols(&mut self)

Clears the header-columns definition.

source

pub fn header_cols(&self) -> Option<Header>

Returns the header columns. These columns are repeated when printing on multiple pages.

source

pub fn add_print_range(&mut self, range: CellRange)

Print ranges.

source

pub fn clear_print_ranges(&mut self)

Remove print ranges.

source

pub fn print_ranges(&self) -> Option<&Vec<CellRange>>

Return the print ranges.

source

pub fn split_col_header(&mut self, col: u32)

Split horizontally on a cell boundary. The splitting is fixed in position.

source

pub fn split_row_header(&mut self, row: u32)

Split vertically on a cell boundary. The splitting is fixed in position.

source

pub fn split_horizontal(&mut self, col: u32)

Split horizontally with a pixel width. The split can be moved around. For more control look at SheetConfig.

source

pub fn split_vertical(&mut self, col: u32)

Split vertically with a pixel width. The split can be moved around. For more control look at SheetConfig.

source

pub fn add_col_group(&mut self, from: u32, to: u32)

Add a column group.

Panic

Column groups can be contained within another, but they can’t overlap. From must be less than or equal to.

source

pub fn remove_col_group(&mut self, from: u32, to: u32)

Remove a column group.

source

pub fn set_col_group_displayed(&mut self, from: u32, to: u32, display: bool)

Change the expansion/collapse of a col group.

Does nothing if no such group exists.

source

pub fn col_group_count(&self) -> usize

Count of column groups.

source

pub fn col_group(&self, idx: usize) -> Option<&Grouped>

Returns the nth column group.

source

pub fn col_group_mut(&mut self, idx: usize) -> Option<&mut Grouped>

Returns the nth column group.

source

pub fn col_group_iter(&self) -> impl Iterator<Item = &Grouped>

Iterate the column groups.

source

pub fn add_row_group(&mut self, from: u32, to: u32)

Add a row group.

Panic

Row groups can be contained within another, but they can’t overlap. From must be less than or equal to.

source

pub fn remove_row_group(&mut self, from: u32, to: u32)

Remove a row group.

source

pub fn set_row_group_displayed(&mut self, from: u32, to: u32, display: bool)

Change the expansion/collapse of a row group.

Does nothing if no such group exists.

source

pub fn row_group_count(&self) -> usize

Count of row groups.

source

pub fn row_group(&self, idx: usize) -> Option<&Grouped>

Returns the nth row group.

source

pub fn row_group_iter(&self) -> impl Iterator<Item = &Grouped>

Iterate row groups.

Trait Implementations§

source§

impl Clone for Sheet

source§

fn clone(&self) -> Sheet

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 Sheet

source§

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

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

impl Default for Sheet

source§

fn default() -> Sheet

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

impl GetSize for Sheet

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
source§

impl<'a> IntoIterator for &'a Sheet

§

type Item = ((u32, u32), CellContentRef<'a>)

The type of the elements being iterated over.
§

type IntoIter = CellIter<'a>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Sheet

§

impl Send for Sheet

§

impl Sync for Sheet

§

impl Unpin for Sheet

§

impl UnwindSafe for Sheet

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.