Writes a run of cells: one sheet, one row, consecutive columns, no gaps.
The run is the unit because writing a rectangle replaces every cell in it, empty ones included. Scattered cells become several ops, one per run, so a write never clears a neighbour it did not mean to touch.
iex> op = Sheetshow.Op.PutCells.new(Sheetshow.row(["Rent", 1000], sheet: "Costs"))
iex> Sheetshow.Op.PutCells.range(op) |> Sheetshow.Range.to_a1()
"Costs!A1:B1"A cell with no value and no style clears the cell it lands on.
Summary
Functions
The column the run starts at.
Builds the op from cells, sorted left to right. The sheet comes from the
cells unless given; ArgumentError if they disagree, sit on different rows
or leave a gap.
The rectangle the op writes, which a backend turns into a grid range.
The row the run sits on.
Types
@type t() :: %Sheetshow.Op.PutCells{cells: [Sheetshow.Cell.t()], sheet: String.t()}
Functions
@spec col(t()) :: non_neg_integer()
The column the run starts at.
iex> Sheetshow.Op.PutCells.new(Sheetshow.row([1], col: 2), "Costs") |> Sheetshow.Op.PutCells.col()
2
@spec new([Sheetshow.Cell.t()], String.t() | nil) :: t()
Builds the op from cells, sorted left to right. The sheet comes from the
cells unless given; ArgumentError if they disagree, sit on different rows
or leave a gap.
iex> Sheetshow.Op.PutCells.new(Sheetshow.row([1, 2]), "Costs").sheet
"Costs"
iex> cells = [Sheetshow.Cell.new("A1", 1), Sheetshow.Cell.new("C1", 3)]
iex> Sheetshow.Op.PutCells.new(cells, "Costs")
** (ArgumentError) a PutCells run has no gaps: column 1 is missing between A1 and C1
@spec range(t()) :: Sheetshow.Range.t()
The rectangle the op writes, which a backend turns into a grid range.
iex> Sheetshow.Op.PutCells.new(Sheetshow.row([1, 2, 3]), "Costs")
...> |> Sheetshow.Op.PutCells.range()
...> |> Sheetshow.Range.to_a1()
"Costs!A1:C1"
@spec row(t()) :: non_neg_integer()
The row the run sits on.
iex> Sheetshow.Op.PutCells.new(Sheetshow.row([1], row: 3), "Costs") |> Sheetshow.Op.PutCells.row()
3