Operations
Class
Constructors
Section titled “Constructors”constructor
Section titled “constructor”+ new Operations(config: Config, dependencyGraph: DependencyGraph, columnSearch: ColumnSearchStrategy, cellContentParser: CellContentParser, parser: ParserWithCaching, stats: Statistics, lazilyTransformingAstService: LazilyTransformingAstService, namedExpressions: NamedExpressions, arraySizePredictor: ArraySizePredictor): Operations
Defined in hyperformula/src/Operations.ts:166
Parameters:
| Name | Type |
|---|---|
config |
Config |
dependencyGraph |
DependencyGraph |
columnSearch |
ColumnSearchStrategy |
cellContentParser |
CellContentParser |
parser |
ParserWithCaching |
stats |
Statistics |
lazilyTransformingAstService |
LazilyTransformingAstService |
namedExpressions |
NamedExpressions |
arraySizePredictor |
ArraySizePredictor |
Returns: Operations
Methods
Section titled “Methods”addColumns
Section titled “addColumns”▸ addColumns(cmd: AddColumnsCommand): [SimpleCellAddress, ClipboardCell][][]
Defined in hyperformula/src/Operations.ts:219
Adds the columns of every span of the command.
Returns, per span, the cells that arrays grown by that span overwrote, in the coordinates from before that span.
Arrays overwrite cells only when called inside recordOverwrites.
Parameters:
| Name | Type |
|---|---|
cmd |
AddColumnsCommand |
Returns: [SimpleCellAddress, ClipboardCell][][]
addNamedExpression
Section titled “addNamedExpression”▸ addNamedExpression(expressionName: string, expression: RawCellContent, sheetId?: undefined | number, options?: NamedExpressionOptions): void
Defined in hyperformula/src/Operations.ts:450
Parameters:
| Name | Type |
|---|---|
expressionName |
string |
expression |
RawCellContent |
sheetId? |
undefined | number |
options? |
NamedExpressionOptions |
Returns: void
addPlaceholderSheetWithId
Section titled “addPlaceholderSheetWithId”▸ addPlaceholderSheetWithId(sheetId: number, name: string): void
Defined in hyperformula/src/Operations.ts:267
Adds a placeholder sheet with a specific ID for undo operations. Used to restore previously merged placeholder sheets.
Note: Unlike addSheetWithId, this does NOT call dependencyGraph.addSheet()
because placeholders don’t need dirty marking or strategy changes - they only
need to exist in the mappings so formulas can reference them again.
Parameters:
| Name | Type |
|---|---|
sheetId |
number |
name |
string |
Returns: void
addRows
Section titled “addRows”▸ addRows(cmd: AddRowsCommand): [SimpleCellAddress, ClipboardCell][][]
Defined in hyperformula/src/Operations.ts:209
Adds the rows of every span of the command.
Returns, per span, the cells that arrays grown by that span overwrote, in the coordinates from before that span.
Arrays overwrite cells only when called inside recordOverwrites.
Parameters:
| Name | Type |
|---|---|
cmd |
AddRowsCommand |
Returns: [SimpleCellAddress, ClipboardCell][][]
addSheet
Section titled “addSheet”▸ addSheet(name?: undefined | string): object
Defined in hyperformula/src/Operations.ts:245
Adds a new sheet to the workbook.
Parameters:
| Name | Type |
|---|---|
name? |
undefined | string |
Returns: object
-
sheetId: number
-
sheetName: string
addSheetWithId
Section titled “addSheetWithId”▸ addSheetWithId(sheetId: number, name: string): void
Defined in hyperformula/src/Operations.ts:254
Adds a sheet with a specific ID for redo operations.
Parameters:
| Name | Type |
|---|---|
sheetId |
number |
name |
string |
Returns: void
changeNamedExpressionExpression
Section titled “changeNamedExpressionExpression”▸ changeNamedExpressionExpression(expressionName: string, newExpression: RawCellContent, sheetId?: undefined | number, options?: NamedExpressionOptions): [InternalNamedExpression, ClipboardCell]
Defined in hyperformula/src/Operations.ts:463
Parameters:
| Name | Type |
|---|---|
expressionName |
string |
newExpression |
RawCellContent |
sheetId? |
undefined | number |
options? |
NamedExpressionOptions |
Returns: [InternalNamedExpression, ClipboardCell]
clearSheet
Section titled “clearSheet”▸ clearSheet(sheetId: number): void
Defined in hyperformula/src/Operations.ts:237
Clears the sheet content.
Parameters:
| Name | Type |
|---|---|
sheetId |
number |
Returns: void
ensureItIsPossibleToMoveCells
Section titled “ensureItIsPossibleToMoveCells”▸ ensureItIsPossibleToMoveCells(sourceLeftCorner: SimpleCellAddress, width: number, height: number, destinationLeftCorner: SimpleCellAddress): void
Defined in hyperformula/src/Operations.ts:496
Parameters:
| Name | Type |
|---|---|
sourceLeftCorner |
SimpleCellAddress |
width |
number |
height |
number |
destinationLeftCorner |
SimpleCellAddress |
Returns: void
forceApplyPostponedTransformations
Section titled “forceApplyPostponedTransformations”▸ forceApplyPostponedTransformations(): void
Defined in hyperformula/src/Operations.ts:786
Forces all formula vertices and column index entries to apply pending lazy transformations, bringing them up to the current LazilyTransformingAstService version. Called before undo of move operations and before compaction.
Returns: void
getAndClearContentChanges
Section titled “getAndClearContentChanges”▸ getAndClearContentChanges(): ContentChanges
Defined in hyperformula/src/Operations.ts:775
Returns: ContentChanges
getClipboardCell
Section titled “getClipboardCell”▸ getClipboardCell(address: SimpleCellAddress): ClipboardCell
Defined in hyperformula/src/Operations.ts:584
Parameters:
| Name | Type |
|---|---|
address |
SimpleCellAddress |
Returns: ClipboardCell
getOldContent
Section titled “getOldContent”▸ getOldContent(address: SimpleCellAddress): [SimpleCellAddress, ClipboardCell]
Defined in hyperformula/src/Operations.ts:565
Parameters:
| Name | Type |
|---|---|
address |
SimpleCellAddress |
Returns: [SimpleCellAddress, ClipboardCell]
getRangeClipboardCells
Section titled “getRangeClipboardCells”▸ getRangeClipboardCells(range: AbsoluteCellRange): [SimpleCellAddress, ClipboardCell][]
Defined in hyperformula/src/Operations.ts:625
Parameters:
| Name | Type |
|---|---|
range |
AbsoluteCellRange |
Returns: [SimpleCellAddress, ClipboardCell][]
getSheetClipboardCells
Section titled “getSheetClipboardCells”▸ getSheetClipboardCells(sheet: number): ClipboardCell[][]
Defined in hyperformula/src/Operations.ts:609
Parameters:
| Name | Type |
|---|---|
sheet |
number |
Returns: ClipboardCell[][]
moveCells
Section titled “moveCells”▸ moveCells(sourceLeftCorner: SimpleCellAddress, width: number, height: number, destinationLeftCorner: SimpleCellAddress): MoveCellsResult
Defined in hyperformula/src/Operations.ts:373
Parameters:
| Name | Type |
|---|---|
sourceLeftCorner |
SimpleCellAddress |
width |
number |
height |
number |
destinationLeftCorner |
SimpleCellAddress |
Returns: MoveCellsResult
moveColumns
Section titled “moveColumns”▸ moveColumns(sheet: number, startColumn: number, numberOfColumns: number, targetColumn: number): number
Defined in hyperformula/src/Operations.ts:354
Parameters:
| Name | Type |
|---|---|
sheet |
number |
startColumn |
number |
numberOfColumns |
number |
targetColumn |
number |
Returns: number
moveRows
Section titled “moveRows”▸ moveRows(sheet: number, startRow: number, numberOfRows: number, targetRow: number): number
Defined in hyperformula/src/Operations.ts:335
Parameters:
| Name | Type |
|---|---|
sheet |
number |
startRow |
number |
numberOfRows |
number |
targetRow |
number |
Returns: number
recordOverwrites
Section titled “recordOverwrites”▸ recordOverwrites‹T›(operation: function): RecordOverwritesResult‹T›
Defined in hyperformula/src/Operations.ts:326
Runs operation with arrayFunctionResultOverwritesData in effect and returns, with its result, every cell
that an array spill overwrote, with the content the cell held just before.
Outside of this method an array never overwrites data, whatever the option says, so only the operations that save these cells for undo (entering content, pasting, adding rows or columns, and their redo) call it.
Type parameters:
▪ T
Parameters:
▪ operation: function
▸ (): T
Returns: RecordOverwritesResult‹T›
removeColumns
Section titled “removeColumns”▸ removeColumns(cmd: RemoveColumnsCommand): ColumnsRemoval[]
Defined in hyperformula/src/Operations.ts:223
Parameters:
| Name | Type |
|---|---|
cmd |
RemoveColumnsCommand |
Returns: ColumnsRemoval[]
removeNamedExpression
Section titled “removeNamedExpression”▸ removeNamedExpression(expressionName: string, sheetId?: undefined | number): [InternalNamedExpression, ClipboardCell]
Defined in hyperformula/src/Operations.ts:477
Parameters:
| Name | Type |
|---|---|
expressionName |
string |
sheetId? |
undefined | number |
Returns: [InternalNamedExpression, ClipboardCell]
removeRows
Section titled “removeRows”▸ removeRows(cmd: RemoveRowsCommand): RowsRemoval[]
Defined in hyperformula/src/Operations.ts:192
Parameters:
| Name | Type |
|---|---|
cmd |
RemoveRowsCommand |
Returns: RowsRemoval[]
removeSheet
Section titled “removeSheet”▸ removeSheet(sheetId: number): [InternalNamedExpression, ClipboardCell][]
Defined in hyperformula/src/Operations.ts:275
Removes a sheet from the workbook.
Parameters:
| Name | Type |
|---|---|
sheetId |
number |
Returns: [InternalNamedExpression, ClipboardCell][]
removeSheetByName
Section titled “removeSheetByName”▸ removeSheetByName(sheetName: string): [InternalNamedExpression‹›, ClipboardCell][]
Defined in hyperformula/src/Operations.ts:287
Removes a sheet from the workbook by name.
Parameters:
| Name | Type |
|---|---|
sheetName |
string |
Returns: [InternalNamedExpression‹›, ClipboardCell][]
renameSheet
Section titled “renameSheet”▸ renameSheet(sheetId: number, newName: string): object
Defined in hyperformula/src/Operations.ts:295
Renames a sheet in the workbook.
Parameters:
| Name | Type |
|---|---|
sheetId |
number |
newName |
string |
Returns: object
-
mergedPlaceholderSheetId? : undefined | number
-
previousDisplayName: Maybe‹string›
-
version? : undefined | number
restoreCell
Section titled “restoreCell”▸ restoreCell(address: SimpleCellAddress, clipboardCell: ClipboardCell): void
Defined in hyperformula/src/Operations.ts:539
Restores a single cell.
Parameters:
| Name | Type |
|---|---|
address |
SimpleCellAddress |
clipboardCell |
ClipboardCell |
Returns: void
restoreClipboardCells
Section titled “restoreClipboardCells”▸ restoreClipboardCells(sourceSheetId: number, cells: IterableIterator‹[SimpleCellAddress, ClipboardCell]›): string[]
Defined in hyperformula/src/Operations.ts:523
Parameters:
| Name | Type |
|---|---|
sourceSheetId |
number |
cells |
IterableIterator‹[SimpleCellAddress, ClipboardCell]› |
Returns: string[]
restoreNamedExpression
Section titled “restoreNamedExpression”▸ restoreNamedExpression(namedExpression: InternalNamedExpression, content: ClipboardCell, sheetId?: undefined | number): void
Defined in hyperformula/src/Operations.ts:456
Parameters:
| Name | Type |
|---|---|
namedExpression |
InternalNamedExpression |
content |
ClipboardCell |
sheetId? |
undefined | number |
Returns: void
rowEffectivelyNotInSheet
Section titled “rowEffectivelyNotInSheet”▸ rowEffectivelyNotInSheet(row: number, sheet: number): boolean
Defined in hyperformula/src/Operations.ts:770
Returns true if row number is outside of given sheet.
Parameters:
| Name | Type | Description |
|---|---|---|
row |
number | row number |
sheet |
number | sheet ID number |
Returns: boolean
setCellContent
Section titled “setCellContent”▸ setCellContent(address: SimpleCellAddress, newCellContent: RawCellContent): [SimpleCellAddress, ClipboardCell]
Defined in hyperformula/src/Operations.ts:633
Parameters:
| Name | Type |
|---|---|
address |
SimpleCellAddress |
newCellContent |
RawCellContent |
Returns: [SimpleCellAddress, ClipboardCell]
setCellEmpty
Section titled “setCellEmpty”▸ setCellEmpty(address: SimpleCellAddress): void
Defined in hyperformula/src/Operations.ts:735
Sets cell content to an empty value. Creates an EmptyCellVertex and updates the dependency graph and column search index.
Parameters:
| Name | Type |
|---|---|
address |
SimpleCellAddress |
Returns: void
setColumnOrder
Section titled “setColumnOrder”▸ setColumnOrder(sheetId: number, columnMapping: [number, number][]): [SimpleCellAddress, ClipboardCell][]
Defined in hyperformula/src/Operations.ts:429
Parameters:
| Name | Type |
|---|---|
sheetId |
number |
columnMapping |
[number, number][] |
Returns: [SimpleCellAddress, ClipboardCell][]
setFormulaToCell
Section titled “setFormulaToCell”▸ setFormulaToCell(address: SimpleCellAddress, size: ArraySize, __namedParameters: object): void
Defined in hyperformula/src/Operations.ts:698
Sets cell content to a formula. Creates a ScalarFormulaVertex and updates the dependency graph and column search index.
Parameters:
▪ address: SimpleCellAddress
▪ size: ArraySize
▪ __namedParameters: object
| Name | Type |
|---|---|
ast |
Ast |
dependencies |
RelativeDependency[] |
hasStructuralChangeFunction |
boolean |
hasVolatileFunction |
boolean |
Returns: void
setFormulaToCellFromAst
Section titled “setFormulaToCellFromAst”▸ setFormulaToCellFromAst(formula: Ast, address: SimpleCellAddress): ContentChanges
Defined in hyperformula/src/Operations.ts:750
Restores a retained formula without depending on its parsing cache entry.
Parameters:
| Name | Type |
|---|---|
formula |
Ast |
address |
SimpleCellAddress |
Returns: ContentChanges
setParsingErrorToCell
Section titled “setParsingErrorToCell”▸ setParsingErrorToCell(rawInput: string, errors: ParsingError[], address: SimpleCellAddress): void
Defined in hyperformula/src/Operations.ts:683
Sets cell content to an instance of parsing error. Creates a ParsingErrorVertex and updates the dependency graph and column search index.
Parameters:
| Name | Type |
|---|---|
rawInput |
string |
errors |
ParsingError[] |
address |
SimpleCellAddress |
Returns: void
setRowOrder
Section titled “setRowOrder”▸ setRowOrder(sheetId: number, rowMapping: [number, number][]): [SimpleCellAddress, ClipboardCell][]
Defined in hyperformula/src/Operations.ts:408
Parameters:
| Name | Type |
|---|---|
sheetId |
number |
rowMapping |
[number, number][] |
Returns: [SimpleCellAddress, ClipboardCell][]
setSheetContent
Section titled “setSheetContent”▸ setSheetContent(sheetId: number, newSheetContent: RawCellContent[][]): void
Defined in hyperformula/src/Operations.ts:669
Parameters:
| Name | Type |
|---|---|
sheetId |
number |
newSheetContent |
RawCellContent[][] |
Returns: void
setValueToCell
Section titled “setValueToCell”▸ setValueToCell(value: RawAndParsedValue, address: SimpleCellAddress): void
Defined in hyperformula/src/Operations.ts:721
Sets cell content to a value. Creates a ValueCellVertex and updates the dependency graph and column search index.
Parameters:
| Name | Type |
|---|---|
value |
RawAndParsedValue |
address |
SimpleCellAddress |
Returns: void