pub struct SheetData { /* private fields */ }Expand description
The cells of a worksheet, by row and column. Both are 1-indexed.
A row can exist without cells: set_row with no cells creates one. The xlsx
importer does that for rows that carry a height or a style and nothing
else, and the exporter writes a <row> element for every row that exists
here, so such rows survive a round trip. Removing the last cell of a row
with remove_cell removes the row.
Rows outside the sheet, below 1 or beyond the last row, cannot hold cells: writing to them does nothing and reading them finds nothing.
Implementations§
Source§impl SheetData
impl SheetData
pub fn new() -> Self
Sourcepub fn cell(&self, row: i32, column: i32) -> Option<Cow<'_, Cell>>
pub fn cell(&self, row: i32, column: i32) -> Option<Cow<'_, Cell>>
The cell at a position, if there is one.
Sourcepub fn cell_mut(&mut self, row: i32, column: i32) -> Option<&mut Cell>
pub fn cell_mut(&mut self, row: i32, column: i32) -> Option<&mut Cell>
The cell at a position, to be changed in place.
Sourcepub fn set_cell(&mut self, row: i32, column: i32, cell: Cell) -> Option<Cell>
pub fn set_cell(&mut self, row: i32, column: i32, cell: Cell) -> Option<Cell>
Puts a cell at a position and returns the one that was there.
Sourcepub fn remove_cell(&mut self, row: i32, column: i32) -> Option<Cell>
pub fn remove_cell(&mut self, row: i32, column: i32) -> Option<Cell>
Removes the cell at a position and returns it.
Sourcepub fn cells(&self) -> impl Iterator<Item = (i32, i32, Cow<'_, Cell>)>
pub fn cells(&self) -> impl Iterator<Item = (i32, i32, Cow<'_, Cell>)>
Every cell of the sheet with its row and column, in natural order: by row, and within a row by column.
Sourcepub fn columns_in_row(&self, row: i32) -> Vec<i32>
pub fn columns_in_row(&self, row: i32) -> Vec<i32>
The columns of a row that have cells, in ascending order.
Sourcepub fn cells_in_row(&self, row: i32) -> Vec<(i32, Cow<'_, Cell>)>
pub fn cells_in_row(&self, row: i32) -> Vec<(i32, Cow<'_, Cell>)>
The cells of a row with their column, in ascending order of column.
Sourcepub fn cells_in_row_between(
&self,
row: i32,
first_column: i32,
last_column: i32,
) -> impl Iterator<Item = (i32, Cow<'_, Cell>)>
pub fn cells_in_row_between( &self, row: i32, first_column: i32, last_column: i32, ) -> impl Iterator<Item = (i32, Cow<'_, Cell>)>
The cells of a row from first_column to last_column, both included,
with their column, in ascending order of column. Reading a stretch of a
row this way finds the row once, not once per cell.
Sourcepub fn numbers_in_row_between(
&self,
row: i32,
first_column: i32,
last_column: i32,
) -> Option<&[f64]>
pub fn numbers_in_row_between( &self, row: i32, first_column: i32, last_column: i32, ) -> Option<&[f64]>
The numbers of a row from first_column to last_column, both
included, if the row holds them as numbers and nothing else, with none
missing. None is no news about the row: its cells say what it holds.
Sourcepub fn remove_row(&mut self, row: i32)
pub fn remove_row(&mut self, row: i32)
Removes every cell of a row, and the row.