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§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: boolWhether or not to show the grid lines in the worksheet
conditional_formatting: Vec<ConditionalFormatting>Implementations§
Source§impl Worksheet
impl Worksheet
pub fn get_name(&self) -> String
pub fn get_sheet_id(&self) -> u32
pub fn set_name(&mut self, name: &str)
pub fn cell(&self, row: i32, column: i32) -> Option<&Cell>
pub fn get_style(&self, row: i32, column: i32) -> i32
pub fn set_style(&mut self, style_index: i32) -> Result<(), String>
pub fn set_column_style( &mut self, column: i32, style_index: i32, ) -> Result<(), String>
pub fn set_row_style( &mut self, row: i32, style_index: i32, ) -> Result<(), String>
pub fn delete_row_style(&mut self, row: i32) -> Result<(), String>
pub fn delete_column_style(&mut self, column: i32) -> Result<(), String>
pub fn set_cell_style( &mut self, row: i32, column: i32, style_index: i32, ) -> Result<(), String>
pub fn set_cell_with_formula( &mut self, row: i32, column: i32, index: i32, style: i32, ) -> Result<(), String>
pub fn set_cell_with_dynamic_formula( &mut self, row: i32, column: i32, index: i32, style: i32, width: i32, height: i32, ) -> Result<(), String>
pub fn set_cell_with_array_formula( &mut self, row: i32, column: i32, index: i32, style: i32, width: i32, height: i32, ) -> Result<(), String>
pub fn set_cell_with_number( &mut self, row: i32, column: i32, value: f64, style: i32, ) -> Result<(), String>
pub fn set_cell_with_string( &mut self, row: i32, column: i32, index: i32, style: i32, ) -> Result<(), String>
pub fn set_cell_with_boolean( &mut self, row: i32, column: i32, value: bool, style: i32, ) -> Result<(), String>
pub fn set_cell_with_error( &mut self, row: i32, column: i32, error: Error, style: i32, ) -> Result<(), String>
pub fn cell_clear_contents( &mut self, row: i32, column: i32, ) -> Result<(), String>
pub fn cell_clear_contents_with_style( &mut self, row: i32, column: i32, style: i32, ) -> Result<(), String>
pub fn set_frozen_rows(&mut self, frozen_rows: i32) -> Result<(), String>
pub fn set_frozen_columns(&mut self, frozen_columns: i32) -> Result<(), String>
Changes the hidden status of a row.
Sourcepub fn set_row_height(&mut self, row: i32, height: f64) -> Result<(), String>
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.
Sourcepub fn set_column_width(
&mut self,
column: i32,
width: f64,
) -> Result<(), String>
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.
Sourcepub fn get_column_width(&self, column: i32) -> Result<f64, String>
pub fn get_column_width(&self, column: i32) -> Result<f64, String>
Return the width of a column in pixels
Sourcepub fn get_actual_column_width(&self, column: i32) -> Result<f64, String>
pub fn get_actual_column_width(&self, column: i32) -> Result<f64, String>
Return the actual width of a column in pixels, ignoring hidden status
Returns true if the column is hidden
Returns if a row is hidden
Sourcepub fn get_column_style(&self, column: i32) -> Result<Option<i32>, String>
pub fn get_column_style(&self, column: i32) -> Result<Option<i32>, String>
Returns the column style index if present
Sourcepub fn row_height(&self, row: i32) -> Result<f64, String>
pub fn row_height(&self, row: i32) -> Result<f64, String>
Returns the height of a row in pixels
Sourcepub fn dimension(&self) -> WorksheetDimension
pub fn dimension(&self) -> WorksheetDimension
Calculates dimension of the sheet. This function isn’t cheap to calculate.
Sourcepub fn is_empty_cell(&self, row: i32, column: i32) -> Result<bool, String>
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.
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