Operator
The edit methods over a workbook. Each one makes the change, keeps it in the history it was built with, and leaves the workbook untouched when the engine refuses any of it. The one module in the package that calls Apiary.
Type Parameters
Section titled “Type Parameters”| Type Parameter | Default type |
|---|---|
TContext |
undefined |
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Operator<TContext = undefined>(props: { history?: History<TContext>; model: Model; writer: string;}): Operator<TContext>;Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
props |
{ history?: History<TContext>; model: Model; writer: string; } |
props.history? |
History<TContext> |
props.model |
Model |
props.writer |
string |
Returns
Section titled “Returns”Operator<TContext>
Properties
Section titled “Properties”| Property | Modifier | Type |
|---|---|---|
writer |
readonly |
string |
Methods
Section titled “Methods”addSheet()
Section titled “addSheet()”addSheet(add: SheetChange, context?: TContext): void;Add an empty sheet after the others as one undoable operation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
add |
SheetChange |
context? |
TContext |
Returns
Section titled “Returns”void
apply()
Section titled “apply()”apply(parts: Part[], operation: EditorOperation): PendingRecord;Makes the change the parts describe and reports it as a record, with the parts that take it back. The history uses this for undo and redo. The parts must come from an operator’s record; parts built any other way are not supported.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
parts |
Part[] |
operation |
EditorOperation |
Returns
Section titled “Returns”applyPaintFormat()
Section titled “applyPaintFormat()”applyPaintFormat(paint: CellsPaint, context?: TContext): void;Make cells formatted exactly like the given styles, as one undoable operation. Cells a merge covers are left as they are.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
paint |
CellsPaint |
context? |
TContext |
Returns
Section titled “Returns”void
clearCells()
Section titled “clearCells()”clearCells(clear: CellsClear, context?: TContext): void;Empty the cells of a range, keeping their formatting, as one undoable operation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
clear |
CellsClear |
context? |
TContext |
Returns
Section titled “Returns”void
deleteCells()
Section titled “deleteCells()”deleteCells(cells: CellsShift<"left" | "up">, context?: TContext): void;Delete a range of cells, moving the cells beyond it into the gap, as one undoable operation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
cells |
CellsShift<"left" | "up"> |
context? |
TContext |
Returns
Section titled “Returns”void
deleteColumns()
Section titled “deleteColumns()”deleteColumns(columns: ColumnsDelete, context?: TContext): void;Delete whole columns, moving the columns right of them left, as one undoable operation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
columns |
ColumnsDelete |
context? |
TContext |
Returns
Section titled “Returns”void
deleteRows()
Section titled “deleteRows()”deleteRows(rows: RowsDelete, context?: TContext): void;Delete whole rows, moving the rows below them up, as one undoable operation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
rows |
RowsDelete |
context? |
TContext |
Returns
Section titled “Returns”void
deleteSheet()
Section titled “deleteSheet()”deleteSheet(remove: SheetChange, context?: TContext): void;Remove a sheet with everything on it as one undoable operation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
remove |
SheetChange |
context? |
TContext |
Returns
Section titled “Returns”void
editCells()
Section titled “editCells()”editCells(edit: CellsEdit, context?: TContext): void;Put values, formulas and styles into cells as one undoable operation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
edit |
CellsEdit |
context? |
TContext |
Returns
Section titled “Returns”void
fill()
Section titled “fill()”fill(fill: CellsFill, context?: TContext): void;Fill a range from a seed range, as the fill handle does, as one undoable operation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
fill |
CellsFill |
context? |
TContext |
Returns
Section titled “Returns”void
formatCells()
Section titled “formatCells()”formatCells(format: CellsFormat, context?: TContext): void;Add formatting to the cells of a range, keeping what else they are formatted with, as one undoable operation. Cells a merge covers are left as they are.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
format |
CellsFormat |
context? |
TContext |
Returns
Section titled “Returns”void
formatRowsOrColumns()
Section titled “formatRowsOrColumns()”formatRowsOrColumns(format: RowsOrColumnsFormat, context?: TContext): void;Format whole rows or columns, so the format also covers cells added later, as one undoable operation. Cells that would not show the format they should, other than cells a merge covers, are formatted on their own.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
format |
RowsOrColumnsFormat |
context? |
TContext |
Returns
Section titled “Returns”void
insertCells()
Section titled “insertCells()”insertCells(cells: CellsShift<"right" | "down">, context?: TContext): void;Insert empty cells at a range, moving the cells there out of the way, as one undoable operation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
cells |
CellsShift<"right" | "down"> |
context? |
TContext |
Returns
Section titled “Returns”void
insertColumn()
Section titled “insertColumn()”insertColumn(insert: ColumnInsert, context?: TContext): void;Insert an empty column at the given position, moving the columns from there right, as one undoable operation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
insert |
ColumnInsert |
context? |
TContext |
Returns
Section titled “Returns”void
insertRow()
Section titled “insertRow()”insertRow(insert: RowInsert, context?: TContext): void;Insert an empty row at the given position, moving the rows from there down, as one undoable operation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
insert |
RowInsert |
context? |
TContext |
Returns
Section titled “Returns”void
mergeCells()
Section titled “mergeCells()”mergeCells(merge: CellsMerge, context?: TContext): void;Merge cells, releasing any merge in the way, as one undoable operation. The cells the merge covers are emptied, as the workbook would empty them.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
merge |
CellsMerge |
context? |
TContext |
Returns
Section titled “Returns”void
moveCells()
Section titled “moveCells()”moveCells(move: CellsMove, context?: TContext): void;Move a block of cells onto a destination of the same size, or onto the block of that size
whose top-left cell to names, as one undoable operation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
move |
CellsMove |
context? |
TContext |
Returns
Section titled “Returns”void
pasteCells()
Section titled “pasteCells()”pasteCells(paste: CellsPaste, context?: TContext): void;Paste a block of cells, merge what was merged in it, and repeat it over a larger selection, as one undoable operation. If any of it is refused nothing is changed.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
paste |
CellsPaste |
context? |
TContext |
Returns
Section titled “Returns”void
renameSheet()
Section titled “renameSheet()”renameSheet(rename: SheetRename, context?: TContext): void;Rename a sheet, keeping formulas pointing at it, as one undoable operation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
rename |
SheetRename |
context? |
TContext |
Returns
Section titled “Returns”void
reorderColumns()
Section titled “reorderColumns()”reorderColumns(reorder: BandReorder, context?: TContext): void;Lift whole columns out and drop them elsewhere as one undoable operation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
reorder |
BandReorder |
context? |
TContext |
Returns
Section titled “Returns”void
reorderRows()
Section titled “reorderRows()”reorderRows(reorder: BandReorder, context?: TContext): void;Lift whole rows out and drop them elsewhere as one undoable operation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
reorder |
BandReorder |
context? |
TContext |
Returns
Section titled “Returns”void
resizeColumn()
Section titled “resizeColumn()”resizeColumn(resize: ColumnResize, context?: TContext): void;Give a column a width as one undoable operation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
resize |
ColumnResize |
context? |
TContext |
Returns
Section titled “Returns”void
resizeRow()
Section titled “resizeRow()”resizeRow(resize: RowResize, context?: TContext): void;Give a row a height as one undoable operation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
resize |
RowResize |
context? |
TContext |
Returns
Section titled “Returns”void
setBorders()
Section titled “setBorders()”setBorders(target: RangeBorders, context?: TContext): void;Put borders on the edges of a range as one undoable operation. Each edge then shows only the border put there, whatever the cell across it had on that edge.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
target |
RangeBorders |
context? |
TContext |
Returns
Section titled “Returns”void
unmergeCells()
Section titled “unmergeCells()”unmergeCells(unmerge: CellsMerge, context?: TContext): void;Release every merge touching a range as one undoable operation.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
unmerge |
CellsMerge |
context? |
TContext |
Returns
Section titled “Returns”void