核心功能

支援 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 DesignZhTW from '@univerjs/design/locale/zh-TW'import { UniverDocsPlugin } from '@univerjs/docs'import { UniverDocsUIPlugin } from '@univerjs/docs-ui'import DocsUIZhTW from '@univerjs/docs-ui/locale/zh-TW'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 SheetsFormulaUIZhTW from '@univerjs/sheets-formula-ui/locale/zh-TW'import { UniverSheetsNumfmtPlugin } from '@univerjs/sheets-numfmt'import { UniverSheetsNumfmtUIPlugin } from '@univerjs/sheets-numfmt-ui'import SheetsNumfmtUIZhTW from '@univerjs/sheets-numfmt-ui/locale/zh-TW'import { UniverSheetsUIPlugin } from '@univerjs/sheets-ui'import SheetsUIZhTW from '@univerjs/sheets-ui/locale/zh-TW'import SheetsZhTW from '@univerjs/sheets/locale/zh-TW'import { UniverUIPlugin } from '@univerjs/ui'import UIZhTW from '@univerjs/ui/locale/zh-TW'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_TW,  locales: {    [LocaleType.ZH_TW]: mergeLocales(      DesignZhTW,      UIZhTW,      DocsUIZhTW,      SheetsZhTW,      SheetsUIZhTW,      SheetsFormulaUIZhTW,      SheetsNumfmtUIZhTW,    ),  },})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 UniverPresetSheetsCoreZhTW from '@univerjs/preset-sheets-core/locales/zh-TW'import { createUniver, LocaleType, mergeLocales } from '@univerjs/presets'import '@univerjs/preset-sheets-core/lib/index.css'const { univerAPI } = createUniver({  locale: LocaleType.ZH_TW,  locales: {    [LocaleType.ZH_TW]: mergeLocales(UniverPresetSheetsCoreZhTW),  },  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.