Advanced Formula Engine
This is the Univer Pro advanced formula engine docs. For the open-source version, see here.
The Advanced Formula Engine optimizes the original formula engine, providing improved calculation performance and richer functionality. It supports a variety of complex formula calculations, can handle large datasets, and offers better error handling and debugging capabilities.
Performance Comparison
The following table compares the Pro formula engine against the OSS formula engine.
| Test File | Formula Count | OSS | Pro | Pro Speedup |
|---|---|---|---|---|
| Synthetic_500K_MixedFormulas | 500,000 | 137.13 s | 132.18 s | 1.04× |
| RealWorld_Engineering_68K | 68,576 | 34.54 s | 6.65 s | 5.19× |
| RealWorld_Financial_33K | 33,617 | 1.34 s | 1.22 s | 1.10× |
| Template_1.4M_Summary | 1,463,721 | 248.62 s | 103.62 s | 2.40× |
Preset Mode
The Advanced Formula Engine is included in the @univerjs/preset-sheets-advanced preset.
Installation
The UniverSheetsAdvancedPreset preset from @univerjs/preset-sheets-advanced depends on the UniverSheetsDrawingPreset preset at runtime. Please install @univerjs/preset-sheets-drawing first.
npm install @univerjs/preset-sheets-drawing @univerjs/preset-sheets-advancedUsage
import { UniverSheetsAdvancedPreset } from '@univerjs/preset-sheets-advanced'
import UniverPresetSheetsAdvancedEnUS from '@univerjs/preset-sheets-advanced/locales/en-US'
import { UniverSheetsCorePreset } from '@univerjs/preset-sheets-core'
import UniverPresetSheetsCoreEnUS from '@univerjs/preset-sheets-core/locales/en-US'
import { UniverSheetsDrawingPreset } from '@univerjs/preset-sheets-drawing'
import UniverPresetSheetsDrawingEnUS from '@univerjs/preset-sheets-drawing/locales/en-US'
import { createUniver, LocaleType, mergeLocales } from '@univerjs/presets'
import '@univerjs/preset-sheets-core/lib/index.css'
import '@univerjs/preset-sheets-drawing/lib/index.css'
import '@univerjs/preset-sheets-advanced/lib/index.css'
const { univerAPI } = createUniver({
locale: LocaleType.En_US,
locales: {
[LocaleType.En_US]: mergeLocales(
UniverPresetSheetsCoreEnUS,
UniverPresetSheetsDrawingEnUS,
UniverPresetSheetsAdvancedEnUS,
),
},
presets: [
UniverSheetsCorePreset(),
UniverSheetsDrawingPreset(),
UniverSheetsAdvancedPreset(),
],
})If you have a commercial license for Univer, please refer to Using License in Client for configuration.
Plugin Mode
Installation
npm install @univerjs-pro/engine-formulaUsage
By using the Advanced Formula Engine, you need to replace the original UniverFormulaEnginePlugin with UniverProFormulaEnginePlugin.
import { UniverProFormulaEnginePlugin } from '@univerjs-pro/engine-formula'
import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula'
univer.registerPlugin(UniverFormulaEnginePlugin)
univer.registerPlugin(UniverProFormulaEnginePlugin) If you have a commercial license for Univer, please refer to Using License in Client for configuration.
How is this guide?
