Skip to main content

Worksheet

Struct Worksheet 

Source
pub struct Worksheet {
Show 17 fields pub dimension: String, pub cols: Vec<Col>, pub rows: Vec<Row>, pub name: String, pub sheet_data: SheetData, pub shared_formulas: Vec<String>, pub sheet_id: u32, pub state: SheetState, pub color: Color, pub merged_cells: Vec<MergedCell>, pub comments: Vec<Comment>, pub frozen_rows: i32, pub frozen_columns: i32, pub views: HashMap<u32, WorksheetView>, pub show_grid_lines: bool, pub conditional_formatting: Vec<ConditionalFormatting>, pub links: HashMap<(i32, i32), Link>,
}
Expand description

Internal representation of a worksheet Excel object

Fields§

§dimension: String§cols: Vec<Col>§rows: Vec<Row>§name: String§sheet_data: SheetData§shared_formulas: Vec<String>§sheet_id: u32§state: SheetState§color: Color§merged_cells: Vec<MergedCell>§comments: Vec<Comment>§frozen_rows: i32§frozen_columns: i32§views: HashMap<u32, WorksheetView>§show_grid_lines: bool

Whether or not to show the grid lines in the worksheet

§conditional_formatting: Vec<ConditionalFormatting>§links: HashMap<(i32, i32), Link>

Hyperlinks in the worksheet, keyed by (row, column) of the cell they are attached to

Implementations§

Source§

impl Worksheet

Source

pub fn get_name(&self) -> String

Source

pub fn get_sheet_id(&self) -> u32

Source

pub fn set_name(&mut self, name: &str)

Source

pub fn cell(&self, row: i32, column: i32) -> Option<Cow<'_, Cell>>

The cell at a position, if there is one. It is borrowed from the sheet if the sheet holds it as a cell, and made for the occasion if it holds it as a number (see SheetData): either way it reads as a &Cell.

Source

pub fn get_style(&self, row: i32, column: i32) -> i32

Source

pub fn set_style(&mut self, style_index: i32) -> Result<(), String>

Source

pub fn set_column_style( &mut self, column: i32, style_index: i32, ) -> Result<(), String>

Source

pub fn set_row_style( &mut self, row: i32, style_index: i32, ) -> Result<(), String>

Source

pub fn delete_row_style(&mut self, row: i32) -> Result<(), String>

Source

pub fn delete_column_style(&mut self, column: i32) -> Result<(), String>

Source

pub fn set_cell_style( &mut self, row: i32, column: i32, style_index: i32, ) -> Result<(), String>

Source

pub fn set_cell_with_formula( &mut self, row: i32, column: i32, index: i32, style: i32, ) -> Result<(), String>

Source

pub fn set_cell_with_dynamic_formula( &mut self, row: i32, column: i32, index: i32, style: i32, width: i32, height: i32, ) -> Result<(), String>

Source

pub fn set_cell_with_array_formula( &mut self, row: i32, column: i32, index: i32, style: i32, width: i32, height: i32, ) -> Result<(), String>

Source

pub fn set_cell_with_number( &mut self, row: i32, column: i32, value: f64, style: i32, ) -> Result<(), String>

Sets a number in a cell. The number has to be finite: no cell holds a NaN or an infinity, and the cell is left as it was if given one.

Source

pub fn set_cell_with_string( &mut self, row: i32, column: i32, index: i32, style: i32, ) -> Result<(), String>

Source

pub fn set_cell_with_boolean( &mut self, row: i32, column: i32, value: bool, style: i32, ) -> Result<(), String>

Source

pub fn set_cell_with_error( &mut self, row: i32, column: i32, error: Error, style: i32, ) -> Result<(), String>

Source

pub fn cell_clear_contents( &mut self, row: i32, column: i32, ) -> Result<(), String>

Source

pub fn cell_clear_contents_with_style( &mut self, row: i32, column: i32, style: i32, ) -> Result<(), String>

Source

pub fn merged_cell_containing( &self, row: i32, column: i32, ) -> Option<&MergedCell>

Returns the merged cell containing (row, column), if any

Source

pub fn is_covered_cell(&self, row: i32, column: i32) -> bool

Returns true if (row, column) is inside a merged range but is not its anchor

Source

pub fn merge_anchor(&self, row: i32, column: i32) -> (i32, i32)

Returns the anchor of the merged cell containing (row, column), or (row, column) itself if the cell is not merged

Source

pub fn set_frozen_rows(&mut self, frozen_rows: i32) -> Result<(), String>

Source

pub fn set_frozen_columns(&mut self, frozen_columns: i32) -> Result<(), String>

Source

pub fn set_row_hidden(&mut self, row: i32, hidden: bool) -> Result<(), String>

Changes the hidden status of a row.

Source

pub fn set_row_height(&mut self, row: i32, height: f64) -> Result<(), String>

Changes the height of a row.

  • If the row does not a have a style we add it.
  • If it has we modify the height and make sure it is applied.

Fails if row index is outside allowed range or height is negative.

Source

pub fn set_column_width( &mut self, column: i32, width: f64, ) -> Result<(), String>

Changes the width of a column.

  • If the column does not a have a width we simply add it
  • If it has, it might be part of a range and we need to split the range.

Fails if column index is outside allowed range or width is negative.

Source

pub fn set_column_hidden( &mut self, column: i32, hidden: bool, ) -> Result<(), String>

Source

pub fn get_column_width(&self, column: i32) -> Result<f64, String>

Return the width of a column in pixels

Source

pub fn get_actual_column_width(&self, column: i32) -> Result<f64, String>

Return the actual width of a column in pixels, ignoring hidden status

Source

pub fn is_column_hidden(&self, column: i32) -> Result<bool, String>

Returns true if the column is hidden

Source

pub fn is_row_hidden(&self, row: i32) -> Result<bool, String>

Returns if a row is hidden

Source

pub fn get_column_style(&self, column: i32) -> Result<Option<i32>, String>

Returns the column style index if present

Source

pub fn row_height(&self, row: i32) -> Result<f64, String>

Returns the height of a row in pixels

Source

pub fn dimension(&self) -> WorksheetDimension

Calculates dimension of the sheet. This function isn’t cheap to calculate.

Source

pub fn is_empty_cell(&self, row: i32, column: i32) -> Result<bool, String>

Returns true if cell is completely empty. Cell with formula that evaluates to empty string is not considered empty.

Source

pub fn navigate_to_edge_in_direction( &self, row: i32, column: i32, direction: NavigationDirection, ) -> Result<(i32, i32), String>

It provides convenient method for user navigation in the spreadsheet by jumping to edges. Spreadsheet engines usually allow this method of navigation by using CTRL+arrows. Behaviour summary:

  • if starting cell is empty then find first non empty cell in given direction
  • if starting cell is not empty, and neighbour in given direction is empty, then find first non empty cell in given direction
  • if starting cell is not empty, and neighbour in given direction is also not empty, then find last non empty cell in given direction

Trait Implementations§

Source§

impl Clone for Worksheet

Source§

fn clone(&self) -> Worksheet

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Worksheet

Source§

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

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

impl<'__de> Decode<'__de> for Worksheet
where '__de:,

Source§

impl Encode for Worksheet

Source§

impl PartialEq for Worksheet

Source§

fn eq(&self, other: &Worksheet) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Worksheet

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> DecodeOwned for T
where T: for<'de> Decode<'de>,

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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V