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
impl Sheet
sourcepub fn new_with_name<S: Into<String>>(name: S) -> Self
👎Deprecated
pub fn new_with_name<S: Into<String>>(name: S) -> Self
Create an empty sheet.
sourcepub fn new<S: Into<String>>(name: S) -> Self
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.
sourcepub fn clone_no_data(&self) -> Self
pub fn clone_no_data(&self) -> Self
Copy all the attributes but not the actual data.
sourcepub fn cell_count(&self) -> usize
pub fn cell_count(&self) -> usize
Count all cells with any data.
sourcepub fn iter_rows<R: RangeBounds<(u32, u32)>>(
&self,
range: R
) -> impl Iterator<Item = ((u32, u32), CellContentRef<'_>)>
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.
sourcepub fn iter_cols<R: RangeBounds<(u32, u32)>>(
&self,
range: R
) -> impl Iterator<Item = ((u32, u32), CellContentRef<'_>)>
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.
sourcepub fn range<R: RangeBounds<(u32, u32)>>(
&self,
range: R
) -> impl Iterator<Item = ((u32, u32), CellContentRef<'_>)>
pub fn range<R: RangeBounds<(u32, u32)>>( &self, range: R ) -> impl Iterator<Item = ((u32, u32), CellContentRef<'_>)>
Iterate a range of cells in lexical order.
sourcepub fn config(&self) -> &SheetConfig
pub fn config(&self) -> &SheetConfig
Configuration for the sheet.
sourcepub fn config_mut(&mut self) -> &mut SheetConfig
pub fn config_mut(&mut self) -> &mut SheetConfig
Configuration for the sheet.
sourcepub fn set_style(&mut self, style: &TableStyleRef)
pub fn set_style(&mut self, style: &TableStyleRef)
Sets the table-style
sourcepub fn style(&self) -> Option<&TableStyleRef>
pub fn style(&self) -> Option<&TableStyleRef>
Returns the table-style.
sourcepub fn set_colstyle(&mut self, col: u32, style: &ColStyleRef)
pub fn set_colstyle(&mut self, col: u32, style: &ColStyleRef)
Column style.
sourcepub fn clear_colstyle(&mut self, col: u32)
pub fn clear_colstyle(&mut self, col: u32)
Remove the style.
sourcepub fn colstyle(&self, col: u32) -> Option<&ColStyleRef>
pub fn colstyle(&self, col: u32) -> Option<&ColStyleRef>
Returns the column style.
sourcepub fn set_col_cellstyle(&mut self, col: u32, style: &CellStyleRef)
pub fn set_col_cellstyle(&mut self, col: u32, style: &CellStyleRef)
Default cell style for this column.
sourcepub fn clear_col_cellstyle(&mut self, col: u32)
pub fn clear_col_cellstyle(&mut self, col: u32)
Remove the style.
sourcepub fn col_cellstyle(&self, col: u32) -> Option<&CellStyleRef>
pub fn col_cellstyle(&self, col: u32) -> Option<&CellStyleRef>
Returns the default cell style for this column.
sourcepub fn set_col_visible(&mut self, col: u32, visible: Visibility)
pub fn set_col_visible(&mut self, col: u32, visible: Visibility)
Visibility of the column
sourcepub fn col_visible(&self, col: u32) -> Visibility
pub fn col_visible(&self, col: u32) -> Visibility
Returns the default cell style for this column.
sourcepub fn _set_col_header_span(&mut self, col: u32, span: u32)
pub fn _set_col_header_span(&mut self, col: u32, span: u32)
unstable internal method
sourcepub fn _col_header_span(&self, col: u32) -> u32
pub fn _col_header_span(&self, col: u32) -> u32
unstable internal method
sourcepub fn set_col_width(&mut self, col: u32, width: Length)
pub fn set_col_width(&mut self, col: u32, width: Length)
Sets the column width for this column.
sourcepub fn _row_header_span(&self, row: u32) -> Option<u32>
pub fn _row_header_span(&self, row: u32) -> Option<u32>
unstable internal method.
sourcepub fn _set_row_header_span(&mut self, row: u32, span: u32)
pub fn _set_row_header_span(&mut self, row: u32, span: u32)
unstable internal method.
sourcepub fn set_rowstyle(&mut self, row: u32, style: &RowStyleRef)
pub fn set_rowstyle(&mut self, row: u32, style: &RowStyleRef)
Row style.
sourcepub fn clear_rowstyle(&mut self, row: u32)
pub fn clear_rowstyle(&mut self, row: u32)
Remove the style.
sourcepub fn rowstyle(&self, row: u32) -> Option<&RowStyleRef>
pub fn rowstyle(&self, row: u32) -> Option<&RowStyleRef>
Returns the row style.
sourcepub fn set_row_cellstyle(&mut self, row: u32, style: &CellStyleRef)
pub fn set_row_cellstyle(&mut self, row: u32, style: &CellStyleRef)
Default cell style for this row.
sourcepub fn clear_row_cellstyle(&mut self, row: u32)
pub fn clear_row_cellstyle(&mut self, row: u32)
Remove the style.
sourcepub fn row_cellstyle(&self, row: u32) -> Option<&CellStyleRef>
pub fn row_cellstyle(&self, row: u32) -> Option<&CellStyleRef>
Returns the default cell style for this row.
sourcepub fn set_row_visible(&mut self, row: u32, visible: Visibility)
pub fn set_row_visible(&mut self, row: u32, visible: Visibility)
Visibility of the row
sourcepub fn row_visible(&self, row: u32) -> Visibility
pub fn row_visible(&self, row: u32) -> Visibility
Returns the default cell style for this row.
sourcepub fn set_row_repeat(&mut self, row: u32, repeat: u32)
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.
sourcepub fn row_repeat(&self, row: u32) -> u32
pub fn row_repeat(&self, row: u32) -> u32
Returns the repeat count for this row.
sourcepub fn set_row_height(&mut self, row: u32, height: Length)
pub fn set_row_height(&mut self, row: u32, height: Length)
Sets the row-height.
sourcepub fn row_height(&self, row: u32) -> Length
pub fn row_height(&self, row: u32) -> Length
Returns the row-height
sourcepub fn _col_header_len(&self) -> usize
pub fn _col_header_len(&self) -> usize
Returns the maximum used column in the column header.
sourcepub fn _row_header_len(&self) -> usize
pub fn _row_header_len(&self) -> usize
Returns the maximum used row in the row header.
sourcepub fn col_header_max(&self) -> u32
pub fn col_header_max(&self) -> u32
Returns the maximum used column in the column header.
sourcepub fn row_header_max(&self) -> u32
pub fn row_header_max(&self) -> u32
Returns the maximum used row in the row header.
sourcepub fn used_grid_size(&self) -> (u32, u32)
pub fn used_grid_size(&self) -> (u32, u32)
Returns a tuple of (max(row)+1, max(col)+1)
sourcepub fn set_display(&mut self, display: bool)
pub fn set_display(&mut self, display: bool)
Is the sheet displayed?
sourcepub fn is_empty(&self, row: u32, col: u32) -> bool
pub fn is_empty(&self, row: u32, col: u32) -> bool
Returns true if there is no SCell at the given position.
sourcepub fn cell(&self, row: u32, col: u32) -> Option<CellContent>
pub fn cell(&self, row: u32, col: u32) -> Option<CellContent>
Returns a clone of the cell content.
sourcepub fn cell_ref(&self, row: u32, col: u32) -> Option<CellContentRef<'_>>
pub fn cell_ref(&self, row: u32, col: u32) -> Option<CellContentRef<'_>>
Returns references to the cell data.
sourcepub fn add_cell(&mut self, row: u32, col: u32, cell: CellContent)
pub fn add_cell(&mut self, row: u32, col: u32, cell: CellContent)
Consumes the CellContent and sets the values.
sourcepub fn remove_cell(&mut self, row: u32, col: u32) -> Option<CellContent>
pub fn remove_cell(&mut self, row: u32, col: u32) -> Option<CellContent>
Removes the cell and returns the values as CellContent.
sourcepub fn set_styled<V: Into<Value>>(
&mut self,
row: u32,
col: u32,
value: V,
style: &CellStyleRef
)
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.
sourcepub fn set_styled_value<V: Into<Value>>(
&mut self,
row: u32,
col: u32,
value: V,
style: &CellStyleRef
)
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.
sourcepub fn set_value<V: Into<Value>>(&mut self, row: u32, col: u32, value: V)
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.
sourcepub fn set_formula<V: Into<String>>(&mut self, row: u32, col: u32, formula: V)
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.
sourcepub fn clear_formula(&mut self, row: u32, col: u32)
pub fn clear_formula(&mut self, row: u32, col: u32)
Removes the formula.
sourcepub fn set_cell_repeat(&mut self, row: u32, col: u32, repeat: u32)
pub fn set_cell_repeat(&mut self, row: u32, col: u32, repeat: u32)
Sets a repeat counter for the cell.
sourcepub fn cell_repeat(&self, row: u32, col: u32) -> u32
pub fn cell_repeat(&self, row: u32, col: u32) -> u32
Returns the repeat counter for the cell within one row.
sourcepub fn set_cellstyle(&mut self, row: u32, col: u32, style: &CellStyleRef)
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.
sourcepub fn clear_cellstyle(&mut self, row: u32, col: u32)
pub fn clear_cellstyle(&mut self, row: u32, col: u32)
Removes the cell-style.
sourcepub fn set_validation(&mut self, row: u32, col: u32, validation: &ValidationRef)
pub fn set_validation(&mut self, row: u32, col: u32, validation: &ValidationRef)
Sets a content-validation for this cell.
sourcepub fn clear_validation(&mut self, row: u32, col: u32)
pub fn clear_validation(&mut self, row: u32, col: u32)
Removes the cell-style.
sourcepub fn validation(&self, row: u32, col: u32) -> Option<&ValidationRef>
pub fn validation(&self, row: u32, col: u32) -> Option<&ValidationRef>
Returns a content-validation name for this cell.
sourcepub fn set_row_span(&mut self, row: u32, col: u32, span: u32)
pub fn set_row_span(&mut self, row: u32, col: u32, span: u32)
Sets the rowspan of the cell. Must be greater than 0.
sourcepub fn set_col_span(&mut self, row: u32, col: u32, span: u32)
pub fn set_col_span(&mut self, row: u32, col: u32, span: u32)
Sets the colspan of the cell. Must be greater than 0.
sourcepub fn set_matrix_row_span(&mut self, row: u32, col: u32, span: u32)
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.
sourcepub fn matrix_row_span(&self, row: u32, col: u32) -> u32
pub fn matrix_row_span(&self, row: u32, col: u32) -> u32
Rowspan of the cell.
sourcepub fn set_matrix_col_span(&mut self, row: u32, col: u32, span: u32)
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.
sourcepub fn matrix_col_span(&self, row: u32, col: u32) -> u32
pub fn matrix_col_span(&self, row: u32, col: u32) -> u32
Colspan of the cell.
sourcepub fn set_annotation(&mut self, row: u32, col: u32, annotation: Annotation)
pub fn set_annotation(&mut self, row: u32, col: u32, annotation: Annotation)
Sets a annotation for this cell.
sourcepub fn clear_annotation(&mut self, row: u32, col: u32)
pub fn clear_annotation(&mut self, row: u32, col: u32)
Removes the annotation.
sourcepub fn annotation(&self, row: u32, col: u32) -> Option<&Annotation>
pub fn annotation(&self, row: u32, col: u32) -> Option<&Annotation>
Returns a content-validation name for this cell.
sourcepub fn annotation_mut(&mut self, row: u32, col: u32) -> Option<&mut Annotation>
pub fn annotation_mut(&mut self, row: u32, col: u32) -> Option<&mut Annotation>
Returns a content-validation name for this cell.
sourcepub fn add_draw_frame(&mut self, row: u32, col: u32, draw_frame: DrawFrame)
pub fn add_draw_frame(&mut self, row: u32, col: u32, draw_frame: DrawFrame)
Add a drawframe to a specific cell.
sourcepub fn clear_draw_frames(&mut self, row: u32, col: u32)
pub fn clear_draw_frames(&mut self, row: u32, col: u32)
Removes all drawframes.
sourcepub fn draw_frames(&self, row: u32, col: u32) -> Option<&Vec<DrawFrame>>
pub fn draw_frames(&self, row: u32, col: u32) -> Option<&Vec<DrawFrame>>
Returns the draw-frames.
sourcepub fn draw_frames_mut(
&mut self,
row: u32,
col: u32
) -> Option<&mut Vec<DrawFrame>>
pub fn draw_frames_mut( &mut self, row: u32, col: u32 ) -> Option<&mut Vec<DrawFrame>>
Returns a content-validation name for this cell.
sourcepub fn set_header_rows(&mut self, row_start: u32, row_end: u32)
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.
sourcepub fn clear_header_rows(&mut self)
pub fn clear_header_rows(&mut self)
Clears the header-rows definition.
sourcepub fn header_rows(&self) -> Option<Header>
pub fn header_rows(&self) -> Option<Header>
Returns the header rows. These rows are repeated when printing on multiple pages.
sourcepub fn set_header_cols(&mut self, col_start: u32, col_end: u32)
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.
sourcepub fn clear_header_cols(&mut self)
pub fn clear_header_cols(&mut self)
Clears the header-columns definition.
sourcepub fn header_cols(&self) -> Option<Header>
pub fn header_cols(&self) -> Option<Header>
Returns the header columns. These columns are repeated when printing on multiple pages.
sourcepub fn add_print_range(&mut self, range: CellRange)
pub fn add_print_range(&mut self, range: CellRange)
Print ranges.
sourcepub fn clear_print_ranges(&mut self)
pub fn clear_print_ranges(&mut self)
Remove print ranges.
sourcepub fn print_ranges(&self) -> Option<&Vec<CellRange>>
pub fn print_ranges(&self) -> Option<&Vec<CellRange>>
Return the print ranges.
sourcepub fn split_col_header(&mut self, col: u32)
pub fn split_col_header(&mut self, col: u32)
Split horizontally on a cell boundary. The splitting is fixed in position.
sourcepub fn split_row_header(&mut self, row: u32)
pub fn split_row_header(&mut self, row: u32)
Split vertically on a cell boundary. The splitting is fixed in position.
sourcepub fn split_horizontal(&mut self, col: u32)
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.
sourcepub fn split_vertical(&mut self, col: u32)
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.
sourcepub fn add_col_group(&mut self, from: u32, to: u32)
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.
sourcepub fn remove_col_group(&mut self, from: u32, to: u32)
pub fn remove_col_group(&mut self, from: u32, to: u32)
Remove a column group.
sourcepub fn set_col_group_displayed(&mut self, from: u32, to: u32, display: bool)
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.
sourcepub fn col_group_count(&self) -> usize
pub fn col_group_count(&self) -> usize
Count of column groups.
sourcepub fn col_group_mut(&mut self, idx: usize) -> Option<&mut Grouped>
pub fn col_group_mut(&mut self, idx: usize) -> Option<&mut Grouped>
Returns the nth column group.
sourcepub fn col_group_iter(&self) -> impl Iterator<Item = &Grouped>
pub fn col_group_iter(&self) -> impl Iterator<Item = &Grouped>
Iterate the column groups.
sourcepub fn add_row_group(&mut self, from: u32, to: u32)
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.
sourcepub fn remove_row_group(&mut self, from: u32, to: u32)
pub fn remove_row_group(&mut self, from: u32, to: u32)
Remove a row group.
sourcepub fn set_row_group_displayed(&mut self, from: u32, to: u32, display: bool)
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.
sourcepub fn row_group_count(&self) -> usize
pub fn row_group_count(&self) -> usize
Count of row groups.
sourcepub fn row_group_iter(&self) -> impl Iterator<Item = &Grouped>
pub fn row_group_iter(&self) -> impl Iterator<Item = &Grouped>
Iterate row groups.