Skip to content

Class

+ 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

▸ 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(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(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(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(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(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(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(sheetId: number): void

Defined in hyperformula/src/Operations.ts:237

Clears the sheet content.

Parameters:

Name Type
sheetId number

Returns: void


▸ 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(): 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(): ContentChanges

Defined in hyperformula/src/Operations.ts:775

Returns: ContentChanges


▸ getClipboardCell(address: SimpleCellAddress): ClipboardCell

Defined in hyperformula/src/Operations.ts:584

Parameters:

Name Type
address SimpleCellAddress

Returns: ClipboardCell


▸ getOldContent(address: SimpleCellAddress): [SimpleCellAddress, ClipboardCell]

Defined in hyperformula/src/Operations.ts:565

Parameters:

Name Type
address SimpleCellAddress

Returns: [SimpleCellAddress, ClipboardCell]


▸ getRangeClipboardCells(range: AbsoluteCellRange): [SimpleCellAddress, ClipboardCell][]

Defined in hyperformula/src/Operations.ts:625

Parameters:

Name Type
range AbsoluteCellRange

Returns: [SimpleCellAddress, ClipboardCell][]


▸ getSheetClipboardCells(sheet: number): ClipboardCell[][]

Defined in hyperformula/src/Operations.ts:609

Parameters:

Name Type
sheet number

Returns: ClipboardCell[][]


▸ 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(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(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‹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(cmd: RemoveColumnsCommand): ColumnsRemoval[]

Defined in hyperformula/src/Operations.ts:223

Parameters:

Name Type
cmd RemoveColumnsCommand

Returns: ColumnsRemoval[]


▸ 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(cmd: RemoveRowsCommand): RowsRemoval[]

Defined in hyperformula/src/Operations.ts:192

Parameters:

Name Type
cmd RemoveRowsCommand

Returns: RowsRemoval[]


▸ 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(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(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(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(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(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(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(address: SimpleCellAddress, newCellContent: RawCellContent): [SimpleCellAddress, ClipboardCell]

Defined in hyperformula/src/Operations.ts:633

Parameters:

Name Type
address SimpleCellAddress
newCellContent RawCellContent

Returns: [SimpleCellAddress, ClipboardCell]


▸ 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(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(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(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(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(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(sheetId: number, newSheetContent: RawCellContent[][]): void

Defined in hyperformula/src/Operations.ts:669

Parameters:

Name Type
sheetId number
newSheetContent RawCellContent[][]

Returns: void


▸ 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