Class CellObj
- class ooodev.utils.data_type.cell_obj.CellObj(col, row, sheet_idx=-1, range_obj=None)[source]
Cell Parts
See also
Changed in version 0.32.0: If index is set to
-2
then no attempt is made to get index from spreadsheet.New in version 0.8.2.
- Parameters:
col (str) –
row (int) –
sheet_idx (int) –
range_obj (mRngObj.RangeObj | None) –
- __init__(col, row, sheet_idx=-1, range_obj=None)
- Parameters:
col (str) –
row (int) –
sheet_idx (int) –
range_obj (mRngObj.RangeObj | None) –
- Return type:
None
- copy()[source]
Copy the current instance.
- Returns:
New instance of CellObj
- Return type:
New in version 0.47.5.
- static from_cell(cell_val: str) ooodev.utils.data_type.cell_obj.CellObj [source]
- static from_cell(cell_val: ooodev.utils.data_type.cell_obj.CellObj) ooodev.utils.data_type.cell_obj.CellObj
- static from_cell(cell_val: ooo.lo.table.cell_address.CellAddress) ooodev.utils.data_type.cell_obj.CellObj
- static from_cell(cell_val: ooodev.utils.data_type.cell_values.CellValues) ooodev.utils.data_type.cell_obj.CellObj
- static from_cell(cell_val)
Gets a
CellObj
instance from a string- Parameters:
cell_val (str | CellAddress | CellValues | CellObj) – Cell value. If
cell_val
is CellObj` then that instance is returned.- Returns:
Cell Object
- Return type:
Note
If a range name such as
A23:G45
orSheet1.A23:G45
then only the first cell is used.
- static from_idx(col_idx, row_idx, sheet_idx=-1)[source]
Gets a
CellObj
from zero-based col and row indexes- Parameters:
col_idx (int) – Column index
row_idx (int) – Row index
sheet_idx (int, optional) – Sheet index
- Returns:
Cell object
- Return type:
- get_range_obj()[source]
Gets a Range object that has start and end column set to this instance cell values.
- Returns:
Range Object
- Return type:
- set_sheet_index(idx=None)[source]
Set the sheet index for the cell.
If
idx
isNone
then the active sheet index is used.- Parameters:
idx (int, optional) – Sheet index, Default
None
.- Returns:
Self
- Return type:
New in version 0.32.0.
- to_string(include_sheet_name=False)[source]
Get a string representation of range
- Parameters:
include_sheet_name (bool, optional) – If
True
and there is a sheet name then it is included in format ofSheet1.A2
; Otherwise format ofA2
.Defaults toFalse
.- Returns:
Gets a string representation such as
A1:T12
- Return type:
str
New in version 0.47.17.
- col: str
Column such as
A
- property left: CellObj
Gets the cell to the left of current cell
- Raises:
IndexError – If cell left is out of range
- Return type:
- range_obj: mRngObj.RangeObj | None = None
Range Object that instance is part of
- row: int
One based row such as
125
- sheet_idx: int = -1
Sheet index that this cell value belongs to. If value is
-1
then the active spreadsheet, if available, is used to get the sheet index. If the value is-2
then no sheet index is applied.
- property sheet_name: str
Gets sheet name
New in version 0.47.17.
- Return type:
str