@univerjs/engine-formula v0.5.4


Class: FFormula

Defined in: submodules/univer/packages/engine-formula/src/facade/f-formula.ts:25

This interface class provides methods to modify the behavior of the operation formula.

Extends

Extended by

Constructors

new FFormula()

new FFormula(
   _commandService, 
   _injector, 
   _lexerTreeBuilder, 
   _configService): FFormula

Defined in: submodules/univer/packages/engine-formula/src/facade/f-formula.ts:26

Parameters

ParameterType
_commandServiceICommandService
_injectorInjector
_lexerTreeBuilderLexerTreeBuilder
_configServiceIConfigService

Returns

FFormula

Overrides

FBase.constructor

Properties

PropertyModifierTypeDefault valueInherited fromDefined in
_commandServicereadonlyICommandServiceundefined-submodules/univer/packages/engine-formula/src/facade/f-formula.ts:27
_configServicereadonlyIConfigServiceundefined-submodules/univer/packages/engine-formula/src/facade/f-formula.ts:30
_disposedprotectedbooleanfalseFBase._disposedsubmodules/univer/packages/core/src/shared/lifecycle.ts:96
_injectorreadonlyInjectorundefined-submodules/univer/packages/engine-formula/src/facade/f-formula.ts:28

Accessors

lexerTreeBuilder

Get Signature

get lexerTreeBuilder(): LexerTreeBuilder

Defined in: submodules/univer/packages/engine-formula/src/facade/f-formula.ts:44

The tree builder for formula string.

Returns

LexerTreeBuilder

Methods

_initialize()

_initialize(): void

Defined in: submodules/univer/packages/engine-formula/src/facade/f-formula.ts:36

Returns

void


calculationEnd()

calculationEnd(callback): IDisposable

Defined in: submodules/univer/packages/engine-formula/src/facade/f-formula.ts:103

Listening calculation ends.

Parameters

ParameterType
callback(functionsExecutedState) => void

Returns

IDisposable


calculationProcessing()

calculationProcessing(callback): IDisposable

Defined in: submodules/univer/packages/engine-formula/src/facade/f-formula.ts:136

Listening calculation processing.

Parameters

ParameterType
callback(stageInfo) => void

Returns

IDisposable


calculationStart()

calculationStart(callback): IDisposable

Defined in: submodules/univer/packages/engine-formula/src/facade/f-formula.ts:90

Listening calculation starts.

Parameters

ParameterType
callback(forceCalculation) => void

Returns

IDisposable


dispose()

dispose(): void

Defined in: submodules/univer/packages/core/src/shared/lifecycle.ts:109

Returns

void

Inherited from

FBase.dispose


disposeWithMe()

disposeWithMe(disposable): IDisposable

Defined in: submodules/univer/packages/core/src/shared/lifecycle.ts:99

Parameters

ParameterType
disposableDisposableLike

Returns

IDisposable

Inherited from

FBase.disposeWithMe


ensureNotDisposed()

protected ensureNotDisposed(): void

Defined in: submodules/univer/packages/core/src/shared/lifecycle.ts:103

Returns

void

Inherited from

FBase.ensureNotDisposed


executeCalculation()

executeCalculation(): void

Defined in: submodules/univer/packages/engine-formula/src/facade/f-formula.ts:75

Start the calculation of the formula.

Returns

void


moveFormulaRefOffset()

moveFormulaRefOffset(
   formulaString, 
   refOffsetX, 
   refOffsetY, 
   ignoreAbsolute?): string

Defined in: submodules/univer/packages/engine-formula/src/facade/f-formula.ts:58

Offsets the formula

Parameters

ParameterTypeDescription
formulaStringstring-
refOffsetXnumber-
refOffsetYnumber-
ignoreAbsolute?booleandefault is false

Returns

string

Example

const result = moveFormulaRefOffset('sum(a1,b2)',1,1)
// result  is 'sum(b2,c3)'

onCalculationEnd()

onCalculationEnd(): Promise<void>

Defined in: submodules/univer/packages/engine-formula/src/facade/f-formula.ts:117

Returns

Promise<void>


sequenceNodesBuilder()

sequenceNodesBuilder(formulaString): (string | ISequenceNode)[]

Defined in: submodules/univer/packages/engine-formula/src/facade/f-formula.ts:68

Resolves the formula string to a ‘node’ node

Parameters

ParameterType
formulaStringstring

Returns

(string | ISequenceNode)[]

{((string | ISequenceNode)[])}

Memberof

FFormula


setMaxIteration()

setMaxIteration(maxIteration): void

Defined in: submodules/univer/packages/engine-formula/src/facade/f-formula.ts:161

When a formula contains a circular reference, set the maximum number of iterations for the formula calculation.

Parameters

ParameterTypeDescription
maxIterationnumberThe maximum number of iterations. The default value is 1.

Returns

void

Example

// Set the maximum number of iterations for the formula calculation to 5.
// The default value is 1.
const formulaEngine = univerAPI.getFormula();
formulaEngine.setMaxIteration(5);

stopCalculation()

stopCalculation(): void

Defined in: submodules/univer/packages/engine-formula/src/facade/f-formula.ts:82

Stop the calculation of the formula.

Returns

void


extend()

static extend(source): void

Defined in: submodules/univer/packages/core/src/facade/f-base.ts:26

Parameters

ParameterType
sourceany

Returns

void

Inherited from

FBase.extend