vimsheet.model.cell

Cell and CellFormat dataclasses.

class vimsheet.model.cell.CellFormat(bold=False, italic=False, underline=False, align='right', fg_color=None, bg_color=None, num_decimals=None, num_format=None, thousands_sep=False)[source]

Bases: object

Visual formatting applied to a single cell.

Parameters:
  • bold (bool)

  • italic (bool)

  • underline (bool)

  • align (Literal['left', 'right', 'center'])

  • fg_color (str | None)

  • bg_color (str | None)

  • num_decimals (int | None)

  • num_format (str | None)

  • thousands_sep (bool)

bold: bool = False
italic: bool = False
underline: bool = False
align: Literal['left', 'right', 'center'] = 'right'
fg_color: str | None = None
bg_color: str | None = None
num_decimals: int | None = None
num_format: str | None = None
thousands_sep: bool = False
copy()[source]

Return a shallow copy of this format.

Return type:

CellFormat

__init__(bold=False, italic=False, underline=False, align='right', fg_color=None, bg_color=None, num_decimals=None, num_format=None, thousands_sep=False)
Parameters:
  • bold (bool)

  • italic (bool)

  • underline (bool)

  • align (Literal['left', 'right', 'center'])

  • fg_color (str | None)

  • bg_color (str | None)

  • num_decimals (int | None)

  • num_format (str | None)

  • thousands_sep (bool)

Return type:

None

class vimsheet.model.cell.Cell(row, col, formula=None, value=None, display='', fmt=<factory>, locked=False, comment=None, history=<factory>)[source]

Bases: object

A single spreadsheet cell with content, formatting, and metadata.

Parameters:
row: int
col: int
formula: str | None = None
value: Any = None
display: str = ''
fmt: CellFormat
locked: bool = False
comment: str | None = None
history: list[tuple[datetime, Any]]
is_empty()[source]

Return True if the cell has no content.

Return type:

bool

record_history(value)[source]

Record a value change in the cell’s history.

Parameters:

value (Any)

Return type:

None

format_value()[source]

Return a display string for the cell’s value, applying format rules.

Return type:

str

copy()[source]

Return a copy of this cell (same position, same content).

Return type:

Cell

__init__(row, col, formula=None, value=None, display='', fmt=<factory>, locked=False, comment=None, history=<factory>)
Parameters:
Return type:

None