Skip to Content
🎉 Univer 0.6.7 is released.Read more →
GuidesUniver SheetsFeaturesCoreCore

Core Features

Facade APIHas Paid PlanUniver ServerUniver on Node.jsPreset
--UniverSheetsCorePreset

Core packages implement the basic functions of the spreadsheet, including the core functions of Univer Sheet, such as creating workbooks, cell editing, cell selection, and formulas.

This feature includes the following plugin packages:

Presets Installation

npm install @univerjs/presets
import { createUniver, defaultTheme, LocaleType, merge } from '@univerjs/presets'; import { UniverSheetsCorePreset } from '@univerjs/presets/preset-sheets-core'; import UniverPresetSheetsCoreEnUS from '@univerjs/presets/preset-sheets-core/locales/en-US'; import '@univerjs/presets/lib/styles/preset-sheets-core.css' const { univerAPI } = createUniver({ locale: LocaleType.EN_US, locales: { [LocaleType.EN_US]: merge( {}, UniverPresetSheetsCoreEnUS ), }, theme: defaultTheme, presets: [ UniverSheetsCorePreset(), ] });

Configuration

createUniver

const { univerAPI } = createUniver({ theme: IStyleSheet;, locale: LocaleType; locales: ILocales; logLevel?: LogLevel; presets: IPresets[], plugins: IPlugins[], });

Presets Configuration

The configuration of the plugin can also be passed directly to the corresponding preset for use, as in the common configuration of @univerjs/ui:

const { univerAPI } = createUniver({ presets: [ UniverSheetsCorePreset({ container?: string | HTMLElement; header?: boolean; toolbar?: boolean; footer?: boolean; contextMenu?: boolean; disableAutoFocus?: true; override?: DependencyOverride; menu?: MenuConfig; disableTextFormatAlert?: boolean; disableTextFormatMark?: boolean; // ... }), ] });
  • container - Container element, can be a string or DOM element.
  • header - Whether to display the header.
  • toolbar - Whether to display the header toolbar. 0.2.0+
  • footer - Whether to display the footer.
  • contextMenu - Whether to display the context menu.
  • disableAutoFocus - Whether to disable auto-focus.
  • override - Dependency injection override configuration.
  • menu - Menu configuration, see Customize menu items (hide menu items)
  • disableTextFormatAlert - Whether to disable cell text format alert.
  • disableTextFormatMark - Whether to disable cell text format mark.

Piecemeal Installation

npm install @univerjs/core @univerjs/design @univerjs/engine-render @univerjs/engine-formula @univerjs/ui @univerjs/docs @univerjs/docs-ui @univerjs/sheets @univerjs/sheets-ui @univerjs/sheets-formula @univerjs/sheets-formula-ui @univerjs/sheets-numfmt
import { LocaleType, merge, Univer } from '@univerjs/core'; import { defaultTheme } from "@univerjs/design"; import { UniverRenderEnginePlugin } from "@univerjs/engine-render"; import { UniverFormulaEnginePlugin } from "@univerjs/engine-formula"; import { UniverUIPlugin } from "@univerjs/ui"; import { UniverDocsPlugin } from "@univerjs/docs"; import { UniverDocsUIPlugin } from "@univerjs/docs-ui"; import { UniverSheetsPlugin } from "@univerjs/sheets"; import { UniverSheetsUIPlugin } from "@univerjs/sheets-ui"; import { UniverSheetsFormulaPlugin } from "@univerjs/sheets-formula"; import { UniverSheetsFormulaUIPlugin } from "@univerjs/sheets-formula-ui"; import { UniverSheetsNumfmtPlugin } from '@univerjs/sheets-numfmt'; import DesignEnUS from '@univerjs/design/locale/en-US'; import UIEnUS from '@univerjs/ui/locale/en-US'; import DocsUIEnUS from '@univerjs/docs-ui/locale/en-US'; import SheetsEnUS from '@univerjs/sheets/locale/en-US'; import SheetsUIEnUS from '@univerjs/sheets-ui/locale/en-US'; import SheetsFormulaUIEnUS from '@univerjs/sheets-formula-ui/locale/en-US'; import SheetsNumfmtEnUS from '@univerjs/sheets-numfmt/locale/en-US'; import "@univerjs/design/lib/index.css"; import "@univerjs/ui/lib/index.css"; import "@univerjs/docs-ui/lib/index.css"; import "@univerjs/sheets-ui/lib/index.css"; import "@univerjs/sheets-formula-ui/lib/index.css"; import '@univerjs/sheets-numfmt/lib/index.css'; import '@univerjs/engine-formula/facade'; import '@univerjs/ui/facade'; import '@univerjs/docs-ui/facade'; import '@univerjs/sheets/facade'; import '@univerjs/sheets-ui/facade'; import '@univerjs/sheets-formula/facade'; import '@univerjs/sheets-numfmt/facade'; const univer = new Univer({ theme: defaultTheme, locale: LocaleType.EN_US, locales: { [LocaleType.EN_US]: merge( {}, DesignEnUS, UIEnUS, DocsUIEnUS, SheetsEnUS, SheetsUIEnUS, SheetsFormulaUIEnUS, SheetsNumfmtEnUS ), }, }); univer.registerPlugin(UniverRenderEnginePlugin); univer.registerPlugin(UniverFormulaEnginePlugin); univer.registerPlugin(UniverUIPlugin, { container: 'app', }); univer.registerPlugin(UniverDocsPlugin); univer.registerPlugin(UniverDocsUIPlugin); univer.registerPlugin(UniverSheetsPlugin); univer.registerPlugin(UniverSheetsUIPlugin); univer.registerPlugin(UniverSheetsFormulaPlugin); univer.registerPlugin(UniverSheetsFormulaUIPlugin); univer.registerPlugin(UniverSheetsNumfmtPlugin);

Configuration

@univerjs/core

@univerjs/core provides some configuration options that can be used to configure the theme, internationalization, etc.

new Univer({ theme: IStyleSheet; locale: LocaleType; locales: ILocales; logLevel?: LogLevel; });

For a complete list of configuration options, see IUniverConfig.

@univerjs/ui

@univerjs/ui provides some configuration options that can be used to configure the basic layout.

univer.registerPlugin(UniverUIPlugin, { container?: string | HTMLElement; header?: boolean; toolbar?: boolean; footer?: boolean; contextMenu?: boolean; disableAutoFocus?: true; override?: DependencyOverride; menu?: MenuConfig; });
  • container - Container element, can be a string or DOM element.
  • header - Whether to display the header.
  • toolbar - Whether to display the header toolbar. 0.2.0+
  • footer - Whether to display the footer.
  • contextMenu - Whether to display the context menu.
  • disableAutoFocus - Whether to disable auto-focus.
  • override - Dependency injection override configuration.
  • menu - Menu configuration, see Customize menu items (hide menu items)

Univer on Node.js Piecemeal Installation

npm install @univerjs/core @univerjs/design @univerjs/engine-render @univerjs/engine-formula @univerjs/docs @univerjs/sheets @univerjs/sheets-formula @univerjs/sheets-numfmt
import { LocaleType, Univer } from '@univerjs/core'; import { defaultTheme } from "@univerjs/design"; import { UniverRenderEnginePlugin } from "@univerjs/engine-render"; import { UniverFormulaEnginePlugin } from "@univerjs/engine-formula"; import { UniverDocsPlugin } from "@univerjs/docs"; import { UniverSheetsPlugin } from "@univerjs/sheets"; import { UniverSheetsFormulaPlugin } from "@univerjs/sheets-formula"; import { UniverSheetsNumfmtPlugin } from '@univerjs/sheets-numfmt'; import '@univerjs/engine-formula/facade'; import '@univerjs/sheets/facade'; import '@univerjs/sheets-formula/facade'; import '@univerjs/sheets-numfmt/facade'; const univer = new Univer({ theme: defaultTheme, locale: LocaleType.ZH_CN, }); univer.registerPlugin(UniverRenderEnginePlugin); univer.registerPlugin(UniverFormulaEnginePlugin); univer.registerPlugin(UniverDocsPlugin); univer.registerPlugin(UniverSheetsPlugin); univer.registerPlugin(UniverSheetsFormulaPlugin); univer.registerPlugin(UniverSheetsNumfmtPlugin);

Was this page helpful?
Last updated on