Struct spreadsheet_ods::refs::CellRange
source · pub struct CellRange { /* private fields */ }
Expand description
A cell-range.
As usual for a spreadsheet this is meant as inclusive from and to.
// // let r1 = CellRange::local(0, 0, 9, 9); // let r2 = CellRange::origin_span(5, 5, (3, 3)); //
Implementations§
source§impl CellRange
impl CellRange
sourcepub fn new_all(
iri: Option<String>,
from_table: Option<String>,
from_row_abs: bool,
from_row: u32,
from_col_abs: bool,
from_col: u32,
to_table: Option<String>,
to_row_abs: bool,
to_row: u32,
to_col_abs: bool,
to_col: u32
) -> Self
pub fn new_all( iri: Option<String>, from_table: Option<String>, from_row_abs: bool, from_row: u32, from_col_abs: bool, from_col: u32, to_table: Option<String>, to_row_abs: bool, to_row: u32, to_col_abs: bool, to_col: u32 ) -> Self
Create a CellRange with all possible arguments.
sourcepub fn local(row: u32, col: u32, to_row: u32, to_col: u32) -> Self
pub fn local(row: u32, col: u32, to_row: u32, to_col: u32) -> Self
Creates the cell range from from + to data.
Panic
If row > to_row or col > to_col.
sourcepub fn remote<S: Into<String>>(
table: S,
row: u32,
col: u32,
to_row: u32,
to_col: u32
) -> Self
pub fn remote<S: Into<String>>( table: S, row: u32, col: u32, to_row: u32, to_col: u32 ) -> Self
Creates the cell range from from + to data.
Panic
If row > to_row or col > to_col.
sourcepub fn origin_span(row: u32, col: u32, span: (u32, u32)) -> Self
pub fn origin_span(row: u32, col: u32, span: (u32, u32)) -> Self
Creates the cell range from origin + spanning data.
Panic
Both span values must be > 0.
sourcepub fn set_table<S: Into<String>>(&mut self, table: S)
pub fn set_table<S: Into<String>>(&mut self, table: S)
Table name for references into other tables.
sourcepub fn set_row_abs(&mut self, abs: bool)
pub fn set_row_abs(&mut self, abs: bool)
“$” row reference
sourcepub fn set_col_abs(&mut self, abs: bool)
pub fn set_col_abs(&mut self, abs: bool)
“$” column reference
sourcepub fn set_to_table<S: Into<String>>(&mut self, table: S)
pub fn set_to_table<S: Into<String>>(&mut self, table: S)
Table name for references into other tables.
sourcepub fn set_to_row(&mut self, to_row: u32)
pub fn set_to_row(&mut self, to_row: u32)
To row
sourcepub fn set_to_row_abs(&mut self, abs: bool)
pub fn set_to_row_abs(&mut self, abs: bool)
“$” row reference
sourcepub fn to_row_abs(&self) -> bool
pub fn to_row_abs(&self) -> bool
“$” row reference
sourcepub fn set_to_col(&mut self, to_col: u32)
pub fn set_to_col(&mut self, to_col: u32)
To column
sourcepub fn set_to_col_abs(&mut self, abs: bool)
pub fn set_to_col_abs(&mut self, abs: bool)
“$” column reference
sourcepub fn to_col_abs(&self) -> bool
pub fn to_col_abs(&self) -> bool
“$” column reference
sourcepub fn to_formula(&self) -> String
pub fn to_formula(&self) -> String
Returns a range reference for a formula.
sourcepub fn absolute_rows(self) -> Self
pub fn absolute_rows(self) -> Self
Makes this CellReference into an absolute reference. The columns remain relative, the rows are fixed.
sourcepub fn absolute_cols(self) -> Self
pub fn absolute_cols(self) -> Self
Makes this CellReference into an absolute reference. The rows remain relative, the columns are fixed.
sourcepub fn contains(&self, row: u32, col: u32) -> bool
pub fn contains(&self, row: u32, col: u32) -> bool
Does the range contain the cell. This is inclusive for to_row and to_col!
sourcepub fn out_looped(&self, row: u32, col: u32) -> bool
pub fn out_looped(&self, row: u32, col: u32) -> bool
Is this range any longer relevant, when looping rows first, then columns?