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

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({ // The theme of the Univer instance, default using the default theme. theme: IStyleSheet; /** * Whether to use dark mode. * @version 0.8.0+ */ darkMode?: boolean; // The locale of the Univer instance. locale: LocaleType; // The locales to be used locales: ILocales; // The log level of the Univer instance. logLevel?: LogLevel; // The list of preset packages to be used. presets: IPresets[]; // The list of plugins to be used. 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 element, can be a string or DOM element. container?: string | HTMLElement; // whether to display the header. header?: boolean; /** * whether to display the header toolbar. * @version 0.2.0+ */ toolbar?: boolean; /** * The type of the header toolbar. default: grouped mode; simple: ungrouped mode. * @version 0.8.1+ */ ribbonType?: RibbonType; // whether to display the footer. footer?: false | { // Sheet bar is the manager of sub sheets, including add/switch/delete sub sheets. sheetBar?: boolean; // statistic bar including statistic info current selections, such as count, sum, average, etc. statisticBar?: boolean; // Including the menus in the footer. such as highlight, gridlines, etc. menus?: boolean; // Zoom slider is the zoom slider in the footer. zoomSlider?: boolean; }; // Whether to display the context menu. contextMenu?: boolean; // Whether to disable auto-focus. disableAutoFocus?: true; // Dependency injection override configuration. override?: DependencyOverride; // Menu configuration menu?: MenuConfig; // ... More configuration options }), ] });

For a complete list of configuration options, see IUniverSheetsCorePresetConfig.

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 @univerjs/sheets-numfmt-ui
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 { UniverSheetsNumfmtUIPlugin } from "@univerjs/sheets-numfmt-ui"; 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 SheetsNumfmtUIEnUS from '@univerjs/sheets-numfmt-ui/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-ui/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, SheetsNumfmtUIEnUS ), }, }); 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); univer.registerPlugin(UniverSheetsNumfmtUIPlugin);

Configuration

@univerjs/core

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

new Univer({ // The theme of the Univer instance, default using the default theme. theme: IStyleSheet; /** * Whether to use dark mode. * @version 0.8.0+ */ darkMode?: boolean; // The locale of the Univer instance. locale: LocaleType; // The locales to be used locales: ILocales; // The log level of the Univer instance. 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, { // The container element, can be a string or DOM element. container?: string | HTMLElement; // Whether to display the header. header?: boolean; /** * whether to display the header toolbar. * @version 0.2.0+ */ toolbar?: boolean; /** * The type of the header toolbar. default: grouped mode; simple: ungrouped mode. * @version 0.8.1+ */ ribbonType?: RibbonType; // Whether to display the context menu. contextMenu?: boolean; // Whether to disable auto-focus. disableAutoFocus?: true; // Dependency injection override configuration. override?: DependencyOverride; // Menu configuration menu?: MenuConfig; });

For a complete list of configuration options, see IUniverUIConfig.

@univerjs/sheets

univer.registerPlugin(UniverSheetsPlugin, { // If the row style and column style be set both, and the row style should precede the column style or not isRowStylePrecedeColumnStyle?: boolean; // Auto height works for merged cells autoHeightForMergedCells?: boolean; });

For a complete list of configuration options, see IUniverSheetsConfig

@univerjs/sheets-ui

univer.registerPlugin(UniverSheetsUIPlugin, { // whether to display the footer. footer?: false | { // Sheet bar is the manager of sub sheets, including add/switch/delete sub sheets. sheetBar?: boolean; // statistic bar including statistic info current selections, such as count, sum, average, etc. statisticBar?: boolean; // Including the menus in the footer. such as highlight, gridlines, etc. menus?: boolean; // Zoom slider is the zoom slider in the footer. zoomSlider?: boolean; }; // Whether to show the formula bar formulaBar?: boolean; clipboardConfig?: { // Whether to display the Paste Options button after a paste operation hidePasteOptions?: boolean; }; // Scroll bar configuration scrollConfig?: IScrollBarProps; // Whether to show the protected range shadow. protectedRangeShadow?: boolean; // Whether to disable the force string alert. disableForceStringAlert?: boolean; // Whether to disable the force string mark. disableForceStringMark?: boolean; // ... More configuration options });

For a complete list of configuration options, see IUniverSheetsUIConfig

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);
Last updated on