核心功能

支持 Headless

Univer Sheets 的核心由电子表格编辑器及其所需的组件组成,包括公式引擎、渲染引擎、数字格式化引擎、设计系统和 UI 组件库。这些部分共同支持多种电子表格格式,并处理实际工作簿中出现的复杂操作。

特性

这些核心功能包括:

  • 电子表格渲染:绘制表格内容、光标和选区。
  • 单元格样式:设置单元格的字体、颜色、边框和对齐方式。
  • 公式计算:添加并计算公式,几乎覆盖所有 Excel 函数,包括数学、统计、文本和日期函数。
  • 数字格式化:把数字格式化成货币、百分比、日期等样式。
  • 网格线和冻结窗格:显示网格线和冻结窗格,便于查看和编辑大数据量的表格。
  • 默认样式:设置电子表格的默认字体、字号、颜色等样式。
  • 插件系统:支持添加自定义插件,例如公式插件、图片插件和图表插件。插件系统也是 Univer 的核心架构能力之一。

插件模式

安装

Shell
pnpm add @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

使用

TypeScript
import { LocaleType, mergeLocales, Univer } from '@univerjs/core'import DesignZhCN from '@univerjs/design/locale/zh-CN'import { UniverDocsPlugin } from '@univerjs/docs'import { UniverDocsUIPlugin } from '@univerjs/docs-ui'import DocsUIZhCN from '@univerjs/docs-ui/locale/zh-CN'import { UniverFormulaEnginePlugin } from '@univerjs/engine-formula'import { UniverRenderEnginePlugin } from '@univerjs/engine-render'import { UniverSheetsPlugin } from '@univerjs/sheets'import { UniverSheetsFormulaPlugin } from '@univerjs/sheets-formula'import { UniverSheetsFormulaUIPlugin } from '@univerjs/sheets-formula-ui'import SheetsFormulaUIZhCN from '@univerjs/sheets-formula-ui/locale/zh-CN'import { UniverSheetsNumfmtPlugin } from '@univerjs/sheets-numfmt'import { UniverSheetsNumfmtUIPlugin } from '@univerjs/sheets-numfmt-ui'import SheetsNumfmtUIZhCN from '@univerjs/sheets-numfmt-ui/locale/zh-CN'import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui'import SheetsUIZhCN from '@univerjs/sheets-ui/locale/zh-CN'import SheetsZhCN from '@univerjs/sheets/locale/zh-CN'import { UniverUIPlugin } from '@univerjs/ui'import UIZhCN from '@univerjs/ui/locale/zh-CN'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({  locale: LocaleType.ZH_CN,  locales: {    [LocaleType.ZH_CN]: mergeLocales(      DesignZhCN,      UIZhCN,      DocsUIZhCN,      SheetsZhCN,      SheetsUIZhCN,      SheetsFormulaUIZhCN,      SheetsNumfmtUIZhCN,    ),  },})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)

插件配置

@univerjs/core

这是 Univer 的核心库,负责创建 Univer 实例,并管理主题、语言等基础功能。

  • theme
    Theme默认值: defaultTheme
    编辑器使用的主题。
    • [palette]
      object
      • [shade]
        string
        按颜色名和色阶组织的调色板,可参照 defaultTheme。
  • darkMode
    boolean默认值: false
    启动时启用深色模式。
  • locale
    string
    菜单和对话框使用的语言。
  • region
    string默认值: 跟随 locale
    地区格式使用的 BCP 47 标签,例如 LocaleType.DE_DE。影响工具栏显示的货币符号。
  • locales
    Record<string, ILanguagePack>
    按语言提供翻译资源。
    • [locale]
      ILanguagePack
      对应语言的翻译包,以该语言的值作为键。
  • logLevel
    LogLevel默认值: LogLevel.INFO
    运行时日志的详细程度。

参考:Univer

@univerjs/engine-render

这是 Univer 的渲染引擎,负责绘制表格内容、滚动条、光标和选区,并导出 UniverRenderEnginePlugin。

参考:@univerjs/engine-render

@univerjs/engine-formula

这是 Univer 的公式引擎,负责计算和处理公式,并导出 UniverFormulaEnginePlugin。

参考:@univerjs/engine-formula

@univerjs/design

这是 Univer 的设计系统,提供全部基础组件和样式。

详见:UI 章节

@univerjs/ui

这是 Univer 的 UI 基座,导出 UniverUIPlugin。

UniverUIPlugin 接受一组用于基础布局的配置项。

  • container
    string | HTMLElement
    编辑器挂载的元素。
  • header
    boolean默认值: true
    显示顶部区域。
  • toolbar
    boolean默认值: true
    显示工具栏。
  • ribbonType
    RibbonType默认值: 'classic'
    选择 Ribbon 布局。
  • contextMenu
    boolean默认值: true
    启用右键菜单。
  • disableAutoFocus
    true
    启动时禁用自动聚焦。
  • menu
    Record<string, object>
    菜单项的顺序、位置和可见性。
    • [id]
      object
      此菜单项、功能区选项卡或分组的覆盖设置。
  • customFontFamily
    IFontConfig[] | object
    在字体下拉列表中添加这些选项。
    • list
      IFontConfig[]
      在字体下拉列表中添加这些选项。
      • value
        string
        CSS 使用的字体名称。
      • label
        string
        显示名称或翻译键。
      • category
        FontCategory
        字体分组,可选 sans-serif、serif、monospace、display 或 handwriting。
    • override
      boolean默认值: false
      用传入的列表替换内置字体选项。
  • override
    [DependencyIdentifier, Provider | null][]
    替换默认注入的依赖。
    • [0]
      DependencyIdentifier
      要替换的依赖标识符。
    • [1]
      Provider | null
      替代的提供者。传入 null 可移除该依赖。

用 menu 可以控制特定菜单项的显示或隐藏:

TypeScript
univer.registerPlugin(UniverUIPlugin, {  menu: {    'sheet.command.set-range-bold': {      hidden: true,    },    'sheet.command.set-range-italic': {      hidden: true,      disabled: true,    },  },})

这里的 'sheet.command.set-range-bold' 和 'sheet.command.set-range-italic' 都是菜单项 ID,完整列表见下方的 菜单项 ID 列表。

参考:@univerjs/ui

@univerjs/docs

这是 Univer Docs 的核心插件,导出 UniverDocsPlugin。

参考:@univerjs/docs

@univerjs/docs-ui

这是 Univer Docs 的 UI 插件,包含文档编辑器的 UI 组件和交互,并导出 UniverDocsUIPlugin。

参考:@univerjs/docs-ui

@univerjs/sheets

这是 Univer Sheets 的核心插件,提供电子表格编辑器的核心功能,导出 UniverSheetsPlugin。

UniverSheetsPlugin 也接收几个编辑器配置项:

  • isRowStylePrecedeColumnStyle
    boolean默认值: false
    让行样式优先于列样式。
  • autoHeightForMergedCells
    boolean默认值: false
    为合并单元格自动调整行高。
  • freezeSync
    boolean默认值: true
    协同时同步冻结行列。
  • textLineGap
    number默认值: 0
    设置单元格文字的额外行距,单位为像素。

参考:@univerjs/sheets

@univerjs/sheets-ui

这是 Univer Sheets 的 UI 插件,包含电子表格编辑器的 UI 组件和交互,并导出 UniverSheetsUIPlugin。

UniverSheetsUIPlugin 接收一组用于调整编辑器 UI 的配置项:

  • formulaBar
    boolean默认值: true
    显示公式栏。
  • clipboardConfig
    object
    粘贴后隐藏选项按钮。
    • hidePasteOptions
      boolean默认值: false
      粘贴后隐藏选项按钮。
  • scrollConfig
    object
    设置滚动条样式和行为。
    • mainScene
      Scene
      滚动条关联的场景。
    • thumbMargin
      number默认值: 2
      轨道和滑块之间的间距,单位为像素。
    • thumbLengthRatio
      number默认值: 1
      滑块长度的倍率。
    • thumbBackgroundColor
      string默认值: 'gray.300'
      滑块颜色。
    • thumbHoverBackgroundColor
      string默认值: 'gray.400'
      悬停时的滑块颜色。
    • thumbActiveBackgroundColor
      string默认值: 'gray.500'
      拖动时的滑块颜色。
    • trackBackgroundColor
      string默认值: 'gray.0'
      轨道的背景颜色。
    • trackBorderColor
      string默认值: 'gray.0'
      轨道的边框颜色。
    • barSize
      number默认值: 10
      滚动轨道的厚度,单位为像素。
    • barBorder
      number默认值: 1
      轨道边框的厚度,单位为像素。
    • enableHorizontal
      boolean默认值: true
      显示横向滚动条。
    • enableVertical
      boolean默认值: true
      显示纵向滚动条。
    • hideTrackWhenUnscrollable
      boolean默认值: false
      对应轴没有溢出时隐藏轨道。
    • minThumbSizeH
      number默认值: 17
      横向滑块的最小宽度,单位为像素。
    • minThumbSizeV
      number默认值: 17
      纵向滑块的最小高度,单位为像素。
  • protectedRangeShadow
    boolean | 'always' | 'non-editable' | 'non-viewable' | 'none'默认值: true
    选择在哪些受保护区域显示阴影。
  • protectedRangeUserSelector
    object
    为保护范围配置自定义用户选择器。
    • component
      ComponentType<IPermissionDetailUserPartProps>
      用于选择用户的组件。
    • framework
      string
      组件使用的框架,例如 react。
  • disableForceStringAlert
    boolean默认值: false
    隐藏强制文本值的提示。
  • disableForceStringMark
    boolean默认值: false
    隐藏强制文本值的标记。
  • maxAutoHeightCount
    number默认值: 1000
    限制自动调整行高的行数。
  • allowArrowKeyWrapOnSheetBoundary
    boolean默认值: true
    方向键到达工作表边界后继续移到另一行或列。
  • selectionAnimation
    boolean默认值: true
    桌面端点击另一个单元格时播放选区动画。遵循系统的动态效果设置。
  • enableFillHandle
    boolean默认值: true
    显示桌面端填充柄。填充命令仍可用。
  • warnBeforeDragOverwrite
    boolean默认值: true
    拖动选区覆盖已有内容前弹出确认。移动校验和撤销仍生效。

参考:@univerjs/sheets-ui

移动端适配

请先配置移动端编辑器。在本页插件模式的初始化代码中,把下面这些桌面端注册替换为同一个包导出的移动端插件,并且必须在打开文档前完成。模型插件、样式、语言包和 Facade 导入均需保留,不要同时注册两个版本。

来源包桌面端注册移动端注册
@univerjs/sheets-formula-uiUniverSheetsFormulaUIPluginUniverSheetsFormulaMobileUIPlugin
@univerjs/sheets-numfmt-uiUniverSheetsNumfmtUIPluginUniverSheetsNumfmtMobileUIPlugin

预设模式

安装

Shell
pnpm add @univerjs/presets @univerjs/preset-sheets-core

使用

TypeScript
import { UniverSheetsCorePreset } from '@univerjs/preset-sheets-core'import UniverPresetSheetsCoreZhCN from '@univerjs/preset-sheets-core/locales/zh-CN'import { createUniver, LocaleType, mergeLocales } from '@univerjs/presets'import '@univerjs/preset-sheets-core/lib/index.css'const { univerAPI } = createUniver({  locale: LocaleType.ZH_CN,  locales: {    [LocaleType.ZH_CN]: mergeLocales(UniverPresetSheetsCoreZhCN),  },  presets: [UniverSheetsCorePreset()],})univerAPI.createWorkbook({})

预设配置

@univerjs/presets

本预设提供 createUniver,用于创建 Univer 应用,并重新导出 @univerjs/core 和 @univerjs/design 的全部方法和对象。

createUniver 接收一个配置对象,其中包含主题、语言、预设等选项。它返回 Univer 实例 univer 和 FUniver 实例 univerAPI,通过后者调用 Facade API。

  • theme
    Theme默认值: defaultTheme
    编辑器使用的主题。
    • [palette]
      object
      • [shade]
        string
        按颜色名和色阶组织的调色板,可参照 defaultTheme。
  • darkMode
    boolean默认值: false
    启动时启用深色模式。
  • locale
    string
    菜单和对话框使用的语言。
  • region
    string默认值: 跟随 locale
    地区格式使用的 BCP 47 标签,例如 LocaleType.DE_DE。影响工具栏显示的货币符号。
  • locales
    Record<string, ILanguagePack>
    按语言提供翻译资源。
    • [locale]
      ILanguagePack
      对应语言的翻译包,以该语言的值作为键。
  • logLevel
    LogLevel默认值: LogLevel.WARN
    运行时日志的详细程度。
  • presets
    (IPreset | [IPreset, IPresetOptions])[]
    要注册的预设。
    • [0]
      IPreset
      预设工厂返回的预设。
    • [1]
      IPresetOptions
      延迟注册该预设的插件。
      • lazy
        boolean
        延迟注册该预设的插件。
    • lazy
      boolean
      延迟注册该预设的插件。
  • plugins
    (PluginCtor | [PluginCtor, object])[]
    注册附加插件及其配置。
    • [0]
      PluginCtor
      插件的构造函数。
    • [1]
      object
      该插件构造函数接受的配置。

参考:createUniver

@univerjs/preset-sheets-core

这是 Univer Sheets 的核心预设,把电子表格所需的文档编辑器、公式引擎、渲染引擎等部分打包在一起。

  • container
    string | HTMLElement默认值: 'app'
    编辑器挂载的元素。
  • header
    boolean默认值: true
    显示顶部区域。
  • toolbar
    boolean默认值: true
    显示工具栏。
  • ribbonType
    RibbonType默认值: 'classic'
    选择 Ribbon 布局。
  • contextMenu
    boolean默认值: true
    启用右键菜单。
  • disableAutoFocus
    true
    启动时禁用自动聚焦。
  • menu
    Record<string, object>
    菜单项的顺序、位置和可见性。
    • [id]
      object
      此菜单项、功能区选项卡或分组的覆盖设置。
  • customFontFamily
    IFontConfig[] | object
    在字体下拉列表中添加这些选项。
    • list
      IFontConfig[]
      在字体下拉列表中添加这些选项。
      • value
        string
        CSS 使用的字体名称。
      • label
        string
        显示名称或翻译键。
      • category
        FontCategory
        字体分组,可选 sans-serif、serif、monospace、display 或 handwriting。
    • override
      boolean默认值: false
      用传入的列表替换内置字体选项。
  • formulaBar
    boolean默认值: true
    显示公式栏。
  • disableTextFormatAlert
    boolean默认值: false
    隐藏单元格文本格式警告。
  • disableTextFormatMark
    boolean默认值: false
    隐藏单元格文本格式标记。
  • sheets
    object
    该功能的配置项。
    • isRowStylePrecedeColumnStyle
      boolean默认值: false
      让行样式优先于列样式。
    • autoHeightForMergedCells
      boolean默认值: false
      为合并单元格自动调整行高。
    • freezeSync
      boolean默认值: true
      协同时同步冻结行列。
    • textLineGap
      number默认值: 0
      设置单元格文字的额外行距,单位为像素。
    • clipboardConfig
      object
      粘贴后隐藏选项按钮。
      • hidePasteOptions
        boolean默认值: false
        粘贴后隐藏选项按钮。
    • scrollConfig
      object
      设置滚动条样式和行为。
    • protectedRangeShadow
      boolean | 'always' | 'non-editable' | 'non-viewable' | 'none'默认值: true
      选择在哪些受保护区域显示阴影。
    • protectedRangeUserSelector
      object
      为保护范围配置自定义用户选择器。
      • component
        ComponentType<IPermissionDetailUserPartProps>
        用于选择用户的组件。
      • framework
        string
        组件使用的框架,例如 react。
    • disableForceStringAlert
      boolean默认值: false
      隐藏强制文本值的提示。
    • disableForceStringMark
      boolean默认值: false
      隐藏强制文本值的标记。
    • maxAutoHeightCount
      number默认值: 1000
      限制自动调整行高的行数。
    • allowArrowKeyWrapOnSheetBoundary
      boolean默认值: true
      方向键到达工作表边界后继续移到另一行或列。
    • selectionAnimation
      boolean默认值: true
      桌面端点击另一个单元格时播放选区动画。遵循系统的动态效果设置。
    • enableFillHandle
      boolean默认值: true
      显示桌面端填充柄。填充命令仍可用。
    • warnBeforeDragOverwrite
      boolean默认值: true
      拖动选区覆盖已有内容前弹出确认。移动校验和撤销仍生效。
  • docs
    object
    该功能的配置项。
    • hasScroll
      boolean
      显示 Docs 滚动条。
  • formula
    object
    配置公式函数、说明、计算模式和函数提示。
    • function
      [Ctor<BaseFunction>, string][]
      自定义公式的实现类。
      • [0]
        Ctor<BaseFunction>
        公式类。
      • [1]
        string
        公式中使用的函数名。
    • description
      object[]
      在编辑器中显示的函数说明。
    • initialFormulaComputing
      CalculationMode默认值: CalculationMode.WHEN_EMPTY
      工作簿打开时的公式计算方式。
    • functionScreenTips
      boolean默认值: true
      编辑公式时显示函数提示。
  • workerURL
    string | URL | Worker
    在浏览器 Worker 中计算公式。

用 menu 可以控制特定菜单项的显示或隐藏:

TypeScript
UniverSheetsCorePreset({  menu: {    'sheet.command.set-range-bold': {      hidden: true,    },    'sheet.command.set-range-italic': {      hidden: true,      disabled: true,    },  },})

这里的 'sheet.command.set-range-bold' 和 'sheet.command.set-range-italic' 都是菜单项 ID,完整列表见下方的 菜单项 ID 列表。

参考:@univerjs/preset-sheets-core

工具栏布局与 RibbonType

在 IUniverSheetsCorePresetConfig 或 IUniverUIConfig 中设置 ribbonType,即可选择工具栏布局。

共有四种模式:

  • classic:默认模式。分组位于上方,工具栏在其下方平铺,与使用者习惯的传统布局一致。
  • grid:保留顶部标签页,每个分组的工具在下方按两行网格排列,适合需要在桌面端同时显示更多工具的场景。
  • collapsed:分组和工具栏位于同一行,适合垂直空间有限的场景。
  • simple:取消分组,所有工具排成一个平铺列表,适合已熟悉各按钮用途的用户。

grid Ribbon 宽度不足时,整组会移入“更多”菜单,并在其中改用紧凑布局;容器变宽后它们会恢复显示。这一切换随可用宽度自动发生,主工具栏仍使用已有的 gridLayout 配置。溢出菜单中的命令、禁用状态和权限检查与主工具栏保持一致。

menu 的键可以是 Ribbon 页签(如 ribbon.insert)、分组(如 ribbon.start.format)或菜单项 ID。

order 按数值从小到大排序同级节点:Ribbon 中的页签、页签中的分组、分组或子菜单中的菜单项。它不会把菜单项移到其他分组。键也可以不使用字符串,而使用 @univerjs/ui 导出的 RibbonPosition 和各分组枚举。

按所用的接入模式,把这些选项合并到现有的初始化配置中。其他插件、语言、主题和容器设置均需保留,同一个插件不要注册两次。

TypeScript
import type { MenuConfig } from '@univerjs/ui'const menu: MenuConfig = {  'ribbon.insert': { order: -1 },  'ribbon.start.format': { order: -1 },  'sheet.command.set-range-font-family': {    order: 0,    gridLayout: { row: 1, column: 1, width: 160 },  },}
TypeScript
import { UniverUIPlugin } from '@univerjs/ui'univer.registerPlugin(UniverUIPlugin, {  ribbonType: 'grid',  menu,})

选区与拖动

工作表边界处的键盘导航

allowArrowKeyWrapOnSheetBoundary 决定方向键到达工作表边界后是否绕到下一行或下一列。默认值为 true,设为 false 时停在边界。选区内使用 Enter/Tab 循环切换不受影响。预设模式下放在 sheets 中,插件模式下直接传给 UniverSheetsUIPlugin。

selectionAnimation: false 关闭在单元格之间切换选区时的选区轮廓动画,系统的减少动态效果设置优先。enableFillHandle: false 隐藏填充柄,填充命令和 Facade API 仍然可用。warnBeforeDragOverwrite: false 跳过拖动覆盖已有内容前的确认提示,移动校验和撤销重做仍然生效。三个选项默认都是 true,可以放在 UniverSheetsCorePreset 的 sheets 中,也可以直接传给 UniverSheetsUIPlugin。

TypeScript
univer.registerPlugin(UniverSheetsUIPlugin, {  allowArrowKeyWrapOnSheetBoundary: false,  selectionAnimation: false,  enableFillHandle: false,  warnBeforeDragOverwrite: false,})

运行时更新

公开 Facade 会合并所做的修改并立即刷新 UI。未指定的属性沿用之前的值或 Schema 默认值,这些覆盖对之后注册的菜单同样生效。插件模式下需要先导入 @univerjs/ui/facade。

TypeScript
import '@univerjs/ui/facade'univerAPI.updateMenuConfig({  'sheet.command.set-range-bold': {    order: 0,    gridLayout: { row: 2, column: 2 },  },  'sheet.command.set-range-italic': {    gridLayout: { row: 2, column: 1 },  },})

gridLayout 仅在 ribbonType: 'grid' 时生效。每个分组固定两行,row 和 column 都从 1 开始。坐标是显式的,因此只修改 order 不会移动显式摆放的按钮。交换两个按钮的位置时,两个按钮都要修改,否则会重叠。可选字段包括 rowSpan、columnSpan、showLabel、width 和 iconSize,尺寸单位为像素。约束和默认值见 IRibbonGridLayout。

自定义菜单的位置

createMenu() 和 createSubmenu() 同样接受 order 和 gridLayout。子菜单中的这两个字段控制 Ribbon 上的触发按钮,而非弹层的内容。以下示例在历史操作分组的第三列添加一个按钮:

TypeScript
univerAPI  .createMenu({    id: 'custom-action',    title: 'Custom action',    action: () => console.log('Custom action clicked'),    order: 4,    gridLayout: { row: 1, column: 3, showLabel: true, width: 96 },  })  .appendTo('ribbon.start.history')

以下各表按桌面端菜单的出现位置整理。同一个菜单项可能出现在多个位置,行标题和列标题菜单也复用了一部分单元格右键菜单。功能菜单需要先注册对应插件,是否显示还取决于权限和当前选中的内容。仅在移动端出现的 ID 单独列在最后。

菜单项 DOM 元素上的 data-u-command 属性即为该菜单项的 ID。配置 menu 时使用的就是这个菜单项 ID,它可能与菜单项执行的命令 ID 不同。

工具栏菜单项

菜单项 ID菜单项名称
univer.command.undo撤销
univer.command.redo重做
ui.operation.activate-format-painter格式刷
sheet.command.set-range-bold加粗
sheet.command.set-range-italic斜体
sheet.command.set-range-underline下划线
sheet.command.set-range-stroke删除线
sheet.command.set-range-font-family字体
sheet.command.set-range-fontsize字号
sheet.command.set-range-text-color文本颜色
sheet.command.set-background-color单元格颜色
sheet.command.set-border-basic边框
sheet.command.set-horizontal-text-align水平对齐
sheet.command.set-vertical-text-align垂直对齐
sheet.command.set-text-wrap文本换行
sheet.command.set-text-rotation文本旋转
sheet.command.add-worksheet-merge合并单元格
sheet.command.add-worksheet-merge-all合并单元格 - 全部合并
sheet.command.add-worksheet-merge-vertical合并单元格 - 垂直合并
sheet.command.add-worksheet-merge-horizontal合并单元格 - 水平合并
sheet.command.remove-worksheet-merge合并单元格 - 取消合并
sheet.operation.open.conditional.formatting.panel条件格式
formula-ui.operation.insert-function.common常用函数
formula-ui.operation.more-functions函数 - 更多函数
sheet.menu.sheets-sort排序
sheet.command.sort-range-asc排序 - 当前区域升序
sheet.command.sort-range-asc-ext排序 - 拓展区域升序
sheet.command.sort-range-desc排序 - 当前区域降序
sheet.command.sort-range-desc-ext排序 - 拓展区域降序
sheet.command.sort-range-custom排序 - 自定义排序
sheet.menu.image图片
sheet.command.insert-float-image图片 - 浮动图片
sheet.command.insert-cell-image图片 - 单元格图片
sheet.command.numfmt.set.currency货币
sheet.command.numfmt.add.decimal.command增加小数位
sheet.command.numfmt.subtract.decimal.command减少小数位
sheet.command.numfmt.set.percent百分比
sheet.operation.open.numfmt.panel数字格式
sheet.menu.data-validation数据验证
data-validation.operation.open-validation-panel数据验证 - 管理数据验证
data-validation.command.addRuleAndOpen数据验证 - 新建规则
sheet.command.smart-toggle-filter筛选
sheet.command.clear-filter-criteria筛选 - 清除筛选条件
sheet.command.re-calc-filter筛选 - 重新计算
sheet.operation.open-pivot-table-range-selector-panel数据透视表
sheet.menu.print打印
sheet.operation.print-open打印 - 打印
sheet.operation.open-print-grid-sidebar打印 - 打印布局
sheet.command.menu-insert-chart插入图表
sheet.command.add-range-protection-from-toolbar保护
univer.operation.toggle-edit-history历史记录
sheet.operation.open-sparkline-selector迷你图
sheet.operation.toggle-comment-panel评论管理
sheet.operation.insert-hyper-link-toolbar插入链接
ui.operation.open-find-dialog查找替换
base-ui.operation.toggle-shortcut-panel打开收起快捷键面板
sheet.command.add-data-bar-conditional-rule数据条
sheet.command.add-icon-set-conditional-rule图标集
sheet.operation.toggle-crosshair-highlight十字高亮
data-validation.command.insert-quick-rule复选框
sheet.menu.quick-dropdown下拉菜单
sheet.menu.quick-date日期
sheet.menu.worksheet-background-image背景图片
sheet.command.add-worksheet-background-image添加背景图片
sheet.command.delete-worksheet-background-image删除背景图片
formula-ui.operation.insert-function.financial财务
formula-ui.operation.insert-function.logical逻辑
formula-ui.operation.insert-function.text文本
formula-ui.operation.insert-function.date日期与时间
formula-ui.operation.insert-function.lookup查找与引用
formula-ui.operation.insert-function.math数学与三角函数
formula-ui.operation.insert-function.statistical统计
formula-ui.operation.insert-function.engineering工程
formula-ui.operation.insert-function.information信息
formula-ui.operation.insert-function.database数据库
sheets-formula-ui.operation.calculation-options计算选项
sheet.operation.open-table-selector表格
sheet.menu.paste粘贴
sheet.command.set-range-font-increase增大字号
sheet.command.set-range-font-decrease减小字号
sheet.command.reset-range-text-color文本颜色 - 重置颜色
sheet.command.reset-background-color单元格颜色 - 重置颜色
sheet.command.set-shrink-to-fit缩小字体填充
sheet.toolbar.sheet-frozen冻结
sheet.menu.zoom-ratio缩放
sheet.command.toggle-gridlines切换网格线
base-ui.operation.toggle-fullscreen全屏
ui.command.clear-formatting清除格式
ui.operation.open-feature-search搜索功能
sheet.toolbar.dimension-outline.group分组
sheet.command.menu-insert-pivot-chart数据透视图
sheet.pivot-chart.insert数据透视图
sheet.command.menu-insert-shape插入形状
sheet.operation.open-shape-object-list-panel图层
sheet.operation.open-slicer-insert-dialog插入切片器
sheet.menu.insert-timeline插入日程表

右键菜单项

菜单项 ID菜单项名称
sheet.command.copy复制
sheet.command.cut剪切
sheet.command.paste粘贴
sheet.menu.copy-special选择性复制
sheet.command.copy-formula-only选择性复制 - 仅复制公式
sheet.menu.paste-special选择性粘贴
sheet.command.paste-value选择性粘贴 - 仅粘贴值
sheet.command.paste-format选择性粘贴 - 仅粘贴格式
sheet.command.paste-col-width选择性粘贴 - 仅粘贴列宽
sheet.command.paste-besides-border选择性粘贴 - 仅粘贴边框以外内容
sheet.command.paste-formula选择性粘贴 - 仅粘贴公式
sheet.menu.clear-selection清除
sheet.command.clear-selection-content清除 - 清除内容
sheet.command.clear-selection-format清除 - 清除格式
sheet.command.clear-selection-all清除 - 清除全部
sheet.contextMenu.text-to-number文本转数字
sheet.menu.cell-insert插入
sheet.command.insert-row-before插入 - 在上方插入行
sheet.command.insert-col-before插入 - 在左侧插入列
sheet.command.insert-range-move-right-confirm插入 - 右移
sheet.command.insert-range-move-down-confirm插入 - 下移
sheet.menu.delete删除
sheet.command.remove-row-confirm删除选中行
sheet.command.remove-col-confirm删除选中列
sheet.command.delete-range-move-left-confirm删除 - 左移
sheet.command.delete-range-move-up-confirm删除 - 上移
sheet.menu.sheet-frozen冻结
sheet.command.set-selection-frozen冻结 - 冻结
sheet.command.set-row-frozen冻结 - 冻结行
sheet.command.set-col-frozen冻结 - 冻结列
sheet.command.cancel-frozen冻结 - 取消冻结
sheet.contextMenu.permission保护行列
sheet.command.add-range-protection-from-context-menu保护行列 - 新增保护范围
sheet.command.set-range-protection-from-context-menu保护行列 - 设置保护范围
sheet.command.delete-range-protection-from-context-menu保护行列 - 移除保护范围
sheet.command.view-sheet-permission-from-context-menu保护行列 - 查看所有保护范围
sheet.menu.sheets-sort-ctx排序
sheet.command.sort-range-asc-ctx排序 - 当前区域升序
sheet.command.sort-range-asc-ext-ctx排序 - 拓展区域升序
sheet.command.sort-range-desc-ctx排序 - 当前区域降序
sheet.command.sort-range-desc-ext-ctx排序 - 拓展区域降序
sheet.command.sort-range-custom-ctx排序 - 自定义排序
sheet.operation.show-comment-modal添加评论
sheet.operation.insert-hyper-link添加链接
sheet.operation.screenshot复制为截图
sheet.command.save-cell-images保存单元格图片
sheet.operation.add-note-popup添加批注
sheet.command.delete-note删除批注
sheet.command.toggle-note-popup显示/隐藏批注
sheet.table.context-insert_menu-id表格插入
sheet.command.table-insert-row插入表格行
sheet.command.table-insert-col插入表格列
sheet.table.context-remove_menu-id表格删除
sheet.command.table-remove-row删除表格行
sheet.command.table-remove-col删除表格列
sheet.command.set-first-row-frozen冻结首行
sheet.command.set-first-column-frozen冻结首列
sheet.sparkline.context-menu-id迷你图
sheet.operation.open-sparkline-panel编辑迷你图
sheet.command.remove-sparkline删除迷你图

右键菜单项 - 行标题

菜单项 ID菜单项名称
sheet.command.insert-multi-rows-above在上方插入行
sheet.command.insert-multi-rows-after在下方插入行
sheet.command.hide-row-confirm隐藏选中行
sheet.command.set-selected-rows-visible显示隐藏行
sheet.command.set-row-height行高
sheet.command.set-row-is-auto-height适合数据
sheet.row-header-menu.sheet-frozen冻结
sheet.contextMenu.dimension-outline分组

右键菜单项 - 列标题

菜单项 ID菜单项名称
sheet.command.insert-multi-cols-before在左侧插入列
sheet.command.insert-multi-cols-right在右侧插入列
sheet.command.hide-col-confirm隐藏选中列
sheet.command.set-selected-cols-visible显示隐藏列
sheet.command.set-worksheet-col-width列宽
sheet.command.set-col-auto-width适合数据
sheet.column-header-menu.sheet-frozen冻结
sheet.contextMenu.dimension-outline分组

右键菜单项 - 工作表标签

菜单项 ID菜单项名称
sheet.command.remove-sheet-confirm删除
sheet.command.copy-sheet复制
sheet.operation.rename-sheet重命名
sheet.command.set-tab-color更改颜色
sheet.command.set-worksheet-hidden隐藏
ui-sheet.command.show-menu-list取消隐藏
sheet.command.add-range-protection-from-sheet-bar保护工作表
sheet.command.delete-worksheet-protection-from-sheet-bar取消保护工作表
sheet.command.change-sheet-protection-from-sheet-bar更改工作表权限
sheet.command.view-sheet-permission-from-sheet-bar查看所有保护范围

数据透视表与透视图右键菜单项

菜单项 ID菜单项名称
sheet.pivot-chart.expand-collapse展开/折叠
sheet.pivot.context-menu.date-group日期分组
sheet.pivot.context-menu.excel-date-group日期分组
sheet.pivot.context-menu.number-group数值分组
sheet.pivot.context-menu.manual-group组合项目
sheet.pivot.context-menu.manual-rename重命名组
sheet.pivot.context-menu.manual-ungroup取消组合
sheet.pivot.context-menu.show-data-as值显示方式
sheet.pivot.context-menu.value-filter值筛选
sheet.pivot.context-menu.date-group.year日期分组 - 年
sheet.pivot.context-menu.date-group.year-quarter日期分组 - 年-季度
sheet.pivot.context-menu.date-group.quarter日期分组 - 季度
sheet.pivot.context-menu.date-group.year-month日期分组 - 年-月
sheet.pivot.context-menu.date-group.month日期分组 - 月
sheet.pivot.context-menu.date-group.month-date日期分组 - 月-日
sheet.pivot.context-menu.date-group.year-month-date日期分组 - 年-月-日
sheet.pivot.context-menu.date-group.date日期分组 - 日
sheet.pivot.context-menu.date-group.hour日期分组 - 小时
sheet.pivot.context-menu.date-group.minute日期分组 - 分钟
sheet.pivot.context-menu.date-group.hour-minute日期分组 - 小时-分钟
sheet.pivot.context-menu.show-data-as.1值显示方式 - 无计算
sheet.pivot.context-menu.show-data-as.4值显示方式 - 总计的百分比
sheet.pivot.context-menu.show-data-as.3值显示方式 - 行汇总的百分比
sheet.pivot.context-menu.show-data-as.2值显示方式 - 列汇总的百分比
sheet.pivot.context-menu.show-data-as.6值显示方式 - 父行汇总的百分比
sheet.pivot.context-menu.show-data-as.5值显示方式 - 父列汇总的百分比
sheet.pivot.context-menu.show-data-as.8值显示方式 - 指数
sheet.pivot.context-menu.show-data-as.14值显示方式 - 父级汇总的百分比
sheet.pivot.context-menu.show-data-as.13值显示方式 - 百分比
sheet.pivot.context-menu.show-data-as.9值显示方式 - 差异值
sheet.pivot.context-menu.show-data-as.10值显示方式 - 差异百分比
sheet.pivot.context-menu.show-data-as.11值显示方式 - 按某一字段汇总
sheet.pivot.context-menu.show-data-as.12值显示方式 - 按某一字段汇总的百分比
sheet.pivot.context-menu.show-data-as.15值显示方式 - 升序排列
sheet.pivot.context-menu.show-data-as.16值显示方式 - 降序排列

绘图与图表菜单项

菜单项 ID菜单项名称
contextMenu.drawing-group组合
drawing.operation.set-drawing-group组合
drawing.operation.cancel-drawing-group取消组合
contextMenu.drawing-arrange排列
drawing.operation.set-drawing-arrange-front置于顶层
drawing.operation.set-drawing-arrange-forward上移一层
drawing.operation.set-drawing-arrange-back置于底层
drawing.operation.set-drawing-arrange-backward下移一层
contextMenu.drawing-align对齐方式
sheet.operation.set-drawing-align-left左对齐
sheet.operation.set-drawing-align-center水平居中
sheet.operation.set-drawing-align-right右对齐
sheet.operation.set-drawing-align-top顶部对齐
sheet.operation.set-drawing-align-middle垂直居中
sheet.operation.set-drawing-align-bottom底部对齐
sheet.operation.set-drawing-align-horizon水平分布
sheet.operation.set-drawing-align-vertical垂直分布
sheet.operation.add-drawing-comment添加评论
sheet.command.chart.open-focused-panel编辑图表
sheet.command.chart.copy-focused-chart复制
sheet.command.chart.export-focused-image导出图片
sheet.command.chart.delete-focused-chart删除图表

上下文工具栏菜单项

选中对应的形状、切片器或时间线时,这些控件才会显示。

菜单项 ID菜单项名称
sheet.operation.apply-shape-quick-style快捷样式
sheet.operation.update-shape-type更改形状
sheets-shape-ui.ribbon.shape-format.style-control形状样式控件
sheets-shape-ui.ribbon.shape-format.text-control形状文本控件
sheet.menu.shape.flip-horizontal水平翻转
sheet.menu.shape.flip-vertical垂直翻转
sheets-shape-ui.ribbon.shape-format.arrange-forward上移一层
sheets-shape-ui.ribbon.shape-format.arrange-backward下移一层
sheets-shape-ui.ribbon.shape-format.arrange-front置于顶层
sheets-shape-ui.ribbon.shape-format.arrange-back置于底层
sheets-shape-ui.ribbon.shape-format.formula-control公式形状控件
sheet.operation.open-sheet-shape-format-panel格式化形状
shape-editor-ui.operation.toggle-floating-toolbar浮动工具栏
sheet.menu.slicer-quick-style快速样式
sheet.menu.slicer-settings切片器设置
sheet.menu.timeline-settings日程表设置
sheet.menu.slicer-connections报表连接

移动端专用菜单项

菜单项 ID菜单项名称
sheet.menu.mobile.crosshair-highlight十字高亮
sheet.menu.mobile.numfmt数字格式
sheet.command.set-once-format-painter格式刷

你觉得这篇文档如何?

© 2026 DreamNum Co., Ltd.