Skip to main content

Worksheet

Struct Worksheet 

Source
pub struct Worksheet {
Show 16 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 merge_cells: Vec<String>, 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>,
}
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§merge_cells: Vec<String>§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>

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

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 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 PartialEq for Worksheet

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

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

Source§

impl Encode for Worksheet

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

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

§

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,

§

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

§

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