univerAPI

GitHubEdit on GitHub
Packages@univerjs/core, @univerjs/ui, @univerjs/watermark, @univerjs-labs/mcp, @univerjs/network, @univerjs/sheets-find-replace, @univerjs/docs-ui, @univerjs/sheets, @univerjs/sheets-ui, @univerjs-pro/exchange-client, @univerjs-pro/collaboration-client, @univerjs/sheets-crosshair-highlight, @univerjs/engine-formula, @univerjs-labs/sheets-mcp, @univerjs-pro/live-share, @univerjs-labs/local-snapshot-manager, @univerjs/sheets-data-validation, @univerjs/sheets-thread-comment, @univerjs/sheets-formula, @univerjs/sheets-drawing-ui, @univerjs-pro/collaboration-client-ui, @univerjs/sheets-formula-ui
CORE

The root Facade API object to interact with Univer. Please use newAPI static method to create a new instance.

This class should not be instantiated directly. Use factory methods on univerAPI instead.

Overview

@univerjs/core

MethodDescription
addEventAdd an event listener
disposeUnitDispose the UniverSheet by the unitId
executeCommandExecute a command with the given id and parameters
extend-
fireEventFire an event, used in internal only
getCurrentLifecycleStageGet the current lifecycle stage
getHooksGet hooks
getUserManager-
loadLocalesLoad locales for the given locale
newAPICreate an FUniver instance, if the injector is not provided, it will create a new Univer instance
newBlobCreate a new blob
newParagraphStyleCreate a new paragraph style
newParagraphStyleValueCreate a new paragraph style value
newRichTextCreate a new rich text
newRichTextValueCreate a new rich text value
newTextDecorationCreate a new text decoration
newTextStyleCreate a new text style
newTextStyleValueCreate a new text style value
onBeforeCommandExecuteRegister a callback that will be triggered before invoking a command
onCommandExecutedRegister a callback that will be triggered when a command is invoked
redoRedo an editing on the currently focused document
registerEventHandler-
setLocaleSet the current locale
syncExecuteCommandExecute a command with the given id and parameters synchronously
toggleDarkModeToggle dark mode on or off
undoUndo an editing on the currently focused document

@univerjs/docs-ui

@univerjs/engine-formula

MethodDescription
getFormula-

@univerjs/network

MethodDescription
createSocket-
getNetwork-

@univerjs/sheets

@univerjs/sheets-crosshair-highlight

@univerjs/sheets-data-validation

MethodDescription
newDataValidation-

@univerjs/sheets-drawing-ui

MethodDescription
registerURLImageDownloader-

@univerjs/sheets-find-replace

MethodDescription
createTextFinderAsync-

@univerjs/sheets-formula

MethodDescription
registerFunction-

@univerjs/sheets-formula-ui

MethodDescription
showRangeSelectorDialog-

@univerjs/sheets-thread-comment

MethodDescription
newTheadComment-

@univerjs/sheets-ui

@univerjs/ui

@univerjs/watermark

MethodDescription
addWatermark-
deleteWatermark-

@univerjs-pro/collaboration-client

@univerjs-pro/collaboration-client-ui

MethodDescription
runOnServer-

@univerjs-pro/exchange-client

MethodDescription
exportDOCXBySnapshotAsync-
exportDOCXByUnitIdAsync-
exportXLSXBySnapshotAsyncExport XLSX file by workbook data
exportXLSXByUnitIdAsyncExport XLSX file by unit id
importDOCXToSnapshotAsyncImport DOCX file to document data
importDOCXToUnitIdAsyncImport DOCX file to unit id
importXLSXToSnapshotAsyncImport XLSX file to workbook data
importXLSXToUnitIdAsyncImport XLSX file to unit id

@univerjs-pro/live-share

@univerjs-labs/local-snapshot-manager

MethodDescription
getLocalSnapshotManager-

@univerjs-labs/mcp

@univerjs-labs/sheets-mcp

MethodDescription
getLintErrors-

APIs

Creation & Bootstrap

createMenu

Signature

createMenu(menuItem: IFacadeMenuItem): FMenu

Parameters

  • menuItem IFacadeMenuItemNo description

Returns

  • FMenu — See signature above.
Source: @univerjs/ui

createSocket

Signature

createSocket(url: string): ISocket

Parameters

  • url stringNo description

Returns

  • ISocket — See signature above.
Source: @univerjs/network

createSubmenu

Signature

createSubmenu(submenuItem: IFacadeSubmenuItem): FSubmenu

Parameters

  • submenuItem IFacadeSubmenuItemNo description

Returns

  • FSubmenu — See signature above.
Source: @univerjs/ui

createTextFinderAsync

Signature

async createTextFinderAsync(text: string): Promise<FTextFinder | null>

Parameters

  • text stringNo description

Returns

  • Promise<FTextFinder> — See signature above.
Source: @univerjs/sheets-find-replace

createUniverDoc

Signature

createUniverDoc(data: Partial<IDocumentData>): FDocument

Parameters

  • data Partial<IDocumentData>No description

Returns

  • FDocument — See signature above.
Source: @univerjs/docs-ui

createUniverSheet

Signature

createUniverSheet(data: Partial<IWorkbookData>, options?: ICreateUnitOptions): FWorkbook

Parameters

  • data Partial<IWorkbookData>No description
  • options ICreateUnitOptions (optional)No description

Returns

  • FWorkbook — See signature above.
Source: @univerjs/sheets

createWorkbook

Signature

createWorkbook(data: Partial<IWorkbookData>, options?: ICreateUnitOptions): FWorkbook

Parameters

  • data Partial<IWorkbookData>No description
  • options ICreateUnitOptions (optional)No description

Returns

  • FWorkbook — See signature above.
Source: @univerjs/sheets

disposeUnit

Dispose the UniverSheet by the unitId. The UniverSheet would be unload from the application.

Signature

disposeUnit(unitId: string): boolean

Parameters

  • unitId stringNo description

Returns

  • boolean — Whether the Univer instance is disposed successfully.

Examples

const fWorkbook = univerAPI.getActiveWorkbook();
const unitId = fWorkbook?.getId();

if (unitId) {
  univerAPI.disposeUnit(unitId);
}
Source: @univerjs/core

newAPI

Create an FUniver instance, if the injector is not provided, it will create a new Univer instance.

Signature

static newAPI(wrapped: Univer | Injector): FUniver

Parameters

  • wrapped anyNo description

Returns

  • FUniver — - The FUniver instance.

Tags

  • @static — *

Examples

const univerAPI = FUniver.newAPI(univer);
Source: @univerjs/core

Unit & Workbook

getActiveWorkbook

Signature

getActiveWorkbook(): FWorkbook | null

Returns

  • FWorkbook — See signature above.
Source: @univerjs/sheets

Commands

executeCommand

Execute a command with the given id and parameters.

Signature

executeCommand<P extends object = object, R = boolean>(id: string, params?: P, options?: IExecutionOptions): Promise<R>

Parameters

  • id stringNo description
  • params P (optional)No description
  • options IExecutionOptions (optional)No description

Returns

  • Promise<R> — The result of the execution. It is a boolean value by default which indicates the command is executed.

Examples

univerAPI.executeCommand('sheet.command.set-range-values', {
  value: { v: "Hello, Univer!" },
  range: { startRow: 0, startColumn: 0, endRow: 0, endColumn: 0 }
});
Source: @univerjs/core

redo

Redo an editing on the currently focused document.

Signature

redo(): Promise<boolean>

Returns

  • Promise<boolean> — redo result

Examples

await univerAPI.redo();
Source: @univerjs/core

syncExecuteCommand

Execute a command with the given id and parameters synchronously.

Signature

syncExecuteCommand<P extends object = object, R = boolean>(id: string, params?: P, options?: IExecutionOptions): R

Parameters

  • id stringNo description
  • params P (optional)No description
  • options IExecutionOptions (optional)No description

Returns

  • R — The result of the execution. It is a boolean value by default which indicates the command is executed.

Examples

univerAPI.syncExecuteCommand('sheet.command.set-range-values', {
  value: { v: "Hello, Univer!" },
  range: { startRow: 0, startColumn: 0, endRow: 0, endColumn: 0 }
});
Source: @univerjs/core

undo

Undo an editing on the currently focused document.

Signature

undo(): Promise<boolean>

Returns

  • Promise<boolean> — undo result

Examples

await univerAPI.undo();
Source: @univerjs/core

Events

addEvent

Add an event listener

Signature

addEvent<T extends keyof IEventParamConfig>(event: T, callback: (params: IEventParamConfig[T]) => void): IDisposable

Parameters

  • event TNo description
  • callback (params: IEventParamConfig[T]) => void — when event triggered

Returns

  • IDisposable — The Disposable instance, for remove the listener

Examples

// Add life cycle changed event listener
const disposable = univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, (params) => {
  const { stage } = params;
  console.log('life cycle changed', params);
});

// Remove the event listener, use `disposable.dispose()`
Source: @univerjs/core

fireEvent

Fire an event, used in internal only.

Signature

fireEvent<T extends keyof IEventParamConfig>(event: T, params: IEventParamConfig[T]): boolean | undefined

Parameters

  • event TNo description
  • params IEventParamConfig[T] — of event

Returns

  • boolean — should cancel

Examples

this.fireEvent(univerAPI.Event.LifeCycleChanged, params);
Source: @univerjs/core

registerEventHandler

Signature

registerEventHandler: (event: string, handler: () => any) => IDisposable

Returns

  • (event: string, handler: () => any) => IDisposable — See signature above.
Source: @univerjs/core

Factories

newBlob

Create a new blob.

Signature

newBlob(): FBlob

Returns

  • FBlob — The new blob instance

Examples

const blob = univerAPI.newBlob();
Source: @univerjs/core

newDataValidation

Deprecated — use univerAPI.newDataValidation() as instead.

Signature

static newDataValidation(): FDataValidationBuilder

Returns

  • FDataValidationBuilder — A new instance of the FDataValidationBuilder class
Source: @univerjs/sheets-data-validation

newDefinedName

Signature

newDefinedName(): FDefinedNameBuilder

Returns

  • FDefinedNameBuilder — See signature above.
Source: @univerjs/sheets

newParagraphStyle

Create a new paragraph style.

Signature

newParagraphStyle(style?: IParagraphStyle): ParagraphStyleBuilder

Parameters

  • style IParagraphStyle (optional)No description

Returns

  • ParagraphStyleBuilder — The new paragraph style instance

Examples

const richText = univerAPI.newRichText({ body: { dataStream: 'Hello World\r\n' } });
const paragraphStyle = univerAPI.newParagraphStyle({ textStyle: { ff: 'Arial', fs: 12, it: univerAPI.Enum.BooleanNumber.TRUE, bl: univerAPI.Enum.BooleanNumber.TRUE } });
richText.insertParagraph(paragraphStyle);
const range = univerAPI.getActiveWorkbook().getActiveSheet().getRange('A1');
range.setRichTextValueForCell(richText);
Source: @univerjs/core

newParagraphStyleValue

Create a new paragraph style value.

Signature

newParagraphStyleValue(style?: IParagraphStyle): ParagraphStyleValue

Parameters

  • style IParagraphStyle (optional)No description

Returns

  • ParagraphStyleValue — The new paragraph style value instance

Examples

const paragraphStyleValue = univerAPI.newParagraphStyleValue();
Source: @univerjs/core

newRichText

Create a new rich text.

Signature

newRichText(data?: IDocumentData): RichTextBuilder

Parameters

  • data IDocumentData (optional)No description

Returns

  • RichTextBuilder — The new rich text instance

Examples

const richText = univerAPI.newRichText({ body: { dataStream: 'Hello World\r\n' } });
const range = univerAPI.getActiveWorkbook().getActiveSheet().getRange('A1');
range.setRichTextValueForCell(richText);
Source: @univerjs/core

newRichTextValue

Create a new rich text value.

Signature

newRichTextValue(data: IDocumentData): RichTextValue

Parameters

  • data IDocumentDataNo description

Returns

  • RichTextValue — The new rich text value instance

Examples

const richTextValue = univerAPI.newRichTextValue({ body: { dataStream: 'Hello World\r\n' } });
const range = univerAPI.getActiveWorkbook().getActiveSheet().getRange('A1');
range.setRichTextValueForCell(richTextValue);
Source: @univerjs/core

newTextDecoration

Create a new text decoration.

Signature

newTextDecoration(decoration?: ITextDecoration): TextDecorationBuilder

Parameters

  • decoration ITextDecoration (optional)No description

Returns

  • TextDecorationBuilder — The new text decoration instance

Examples

const decoration = univerAPI.newTextDecoration();
Source: @univerjs/core

newTextStyle

Create a new text style.

Signature

newTextStyle(style?: ITextStyle): TextStyleBuilder

Parameters

  • style ITextStyle (optional)No description

Returns

  • TextStyleBuilder — The new text style instance

Examples

const textStyle = univerAPI.newTextStyle();
Source: @univerjs/core

newTextStyleValue

Create a new text style value.

Signature

newTextStyleValue(style?: ITextStyle): TextStyleValue

Parameters

  • style ITextStyle (optional)No description

Returns

  • TextStyleValue — The new text style value instance

Examples

const textStyleValue = univerAPI.newTextStyleValue();
Source: @univerjs/core

newTheadComment

Signature

newTheadComment(comment?: IThreadComment): FTheadCommentBuilder

Parameters

  • comment IThreadComment (optional)No description

Returns

  • FTheadCommentBuilder — See signature above.
Source: @univerjs/sheets-thread-comment

Environment

setLocale

Set the current locale.

Signature

setLocale(locale: string): void

Parameters

  • locale stringNo description

Examples

univerAPI.setLocale('esES');
Source: @univerjs/core

toggleDarkMode

Toggle dark mode on or off.

Signature

toggleDarkMode(isDarkMode: boolean): void

Parameters

  • isDarkMode booleanNo description

Examples

univerAPI.toggleDarkMode(true);
Source: @univerjs/core

Miscellaneous

addFonts

Signature

addFonts(fonts: IFontConfig[]): void

Parameters

  • fonts IFontConfig[]No description
Source: @univerjs/ui

addWatermark

Signature

addWatermark(type: IWatermarkTypeEnum.Text | IWatermarkTypeEnum.Image, config: ITextWatermarkConfig | IImageWatermarkConfig): FUniver

Parameters

  • type IWatermarkTypeEnum.Text | IWatermarkTypeEnum.ImageNo description
  • config ITextWatermarkConfig | IImageWatermarkConfigNo description

Returns

  • FUniver — See signature above.
Source: @univerjs/watermark

callMCPTool

Signature

callMCPTool(toolName: string, params: unknown): Promise<any>

Parameters

  • toolName stringNo description
  • params unknownNo description

Returns

  • Promise<any> — See signature above.
Source: @univerjs-labs/mcp

connectMCP

Signature

connectMCP(): void
Source: @univerjs-labs/mcp

copy

Signature

copy(): Promise<boolean>

Returns

  • Promise<boolean> — See signature above.
Source: @univerjs/ui

customizeColumnHeader

Signature

customizeColumnHeader(cfg: IColumnsHeaderCfgParam): void

Parameters

  • cfg IColumnsHeaderCfgParamNo description
Source: @univerjs/sheets-ui

customizeRowHeader

Signature

customizeRowHeader(cfg: IRowsHeaderCfgParam): void

Parameters

  • cfg IRowsHeaderCfgParamNo description
Source: @univerjs/sheets-ui

deleteWatermark

Signature

deleteWatermark(): FUniver

Returns

  • FUniver — See signature above.
Source: @univerjs/watermark

disconnectMCP

Signature

disconnectMCP(): void
Source: @univerjs-labs/mcp

exportDOCXBySnapshotAsync

Signature

async exportDOCXBySnapshotAsync(snapshot: IDocumentData): Promise<File | undefined>

Parameters

  • snapshot IDocumentDataNo description

Returns

  • Promise<File> — See signature above.
Source: @univerjs-pro/exchange-client

exportDOCXByUnitIdAsync

Signature

async exportDOCXByUnitIdAsync(unitId: string): Promise<File | undefined>

Parameters

  • unitId stringNo description

Returns

  • Promise<File> — See signature above.
Source: @univerjs-pro/exchange-client

exportXLSXBySnapshotAsync

Export XLSX file by workbook data

Signature

async exportXLSXBySnapshotAsync(snapshot: IWorkbookData): Promise<File | undefined>

Parameters

  • snapshot IWorkbookDataNo description

Returns

  • Promise<File> — See signature above.
Source: @univerjs-pro/exchange-client

exportXLSXByUnitIdAsync

Export XLSX file by unit id

Signature

async exportXLSXByUnitIdAsync(unitId: string): Promise<File | undefined>

Parameters

  • unitId stringNo description

Returns

  • Promise<File> — See signature above.
Source: @univerjs-pro/exchange-client

extend

Signature

static extend(source: any): void

Parameters

  • source anyNo description
Source: @univerjs/core

getActiveDocument

Signature

getActiveDocument(): FDocument | null

Returns

  • FDocument — See signature above.
Source: @univerjs/docs-ui

getActiveSheet

Signature

getActiveSheet(): Nullable<{ workbook: FWorkbook; worksheet: FWorksheet }>

Returns

  • Nullable<{ workbook: FWorkbook; worksheet: FWorksheet; }> — See signature above.
Source: @univerjs/sheets

getActiveUniverSheet

Signature

getActiveUniverSheet(): FWorkbook | null

Returns

  • FWorkbook — See signature above.
Source: @univerjs/sheets

getAllMCPTools

Signature

getAllMCPTools(): IMCPTool[]

Returns

  • IMCPTool[] — See signature above.
Source: @univerjs-labs/mcp

getCollaboration

Signature

getCollaboration(): FCollaboration

Returns

  • FCollaboration — See signature above.
Source: @univerjs-pro/collaboration-client

getCommandSheetTarget

Signature

getCommandSheetTarget(commandInfo: ICommandInfo<object>): Nullable<{ workbook: FWorkbook; worksheet: FWorksheet }>

Parameters

  • commandInfo ICommandInfo<object>No description

Returns

  • Nullable<{ workbook: FWorkbook; worksheet: FWorksheet; }> — See signature above.
Source: @univerjs/sheets

getComponentManager

Signature

getComponentManager(): ComponentManager

Returns

  • ComponentManager — See signature above.
Source: @univerjs/ui

getCrosshairHighlightColor

Signature

getCrosshairHighlightColor(): string

Returns

  • string — See signature above.
Source: @univerjs/sheets-crosshair-highlight

getCrosshairHighlightEnabled

Signature

getCrosshairHighlightEnabled(): boolean

Returns

  • boolean — See signature above.
Source: @univerjs/sheets-crosshair-highlight

getCurrentLifecycleStage

Get the current lifecycle stage.

Signature

getCurrentLifecycleStage(): LifecycleStages

Returns

  • LifecycleStages — - The current lifecycle stage.

Examples

const stage = univerAPI.getCurrentLifecycleStage();
console.log(stage);
Source: @univerjs/core

getFormula

Signature

getFormula(): FFormula

Returns

  • FFormula — See signature above.
Source: @univerjs/engine-formula

getHooks

Deprecated — use addEvent instead.

Get hooks.

Signature

getHooks(): FHooks

Returns

  • FHooks — FHooks instance
Source: @univerjs/core

getLintErrors

Signature

async getLintErrors(): Promise<ILintErrorReport>

Returns

  • Promise<ILintErrorReport> — See signature above.
Source: @univerjs-labs/sheets-mcp

getLiveShareStatus

Signature

getLiveShareStatus(): LiveShareStatus

Returns

  • LiveShareStatus — See signature above.
Source: @univerjs-pro/live-share

getLocalSnapshotManager

Signature

getLocalSnapshotManager(): FLocalSnapshotManager

Returns

  • FLocalSnapshotManager — See signature above.
Source: @univerjs-labs/local-snapshot-manager

getMCPConnectionStatus

Signature

getMCPConnectionStatus(): string

Returns

  • string — See signature above.
Source: @univerjs-labs/mcp

getNetwork

Signature

getNetwork(): FNetwork

Returns

  • FNetwork — See signature above.
Source: @univerjs/network

getProtectedRangeShadowStrategy

Signature

getProtectedRangeShadowStrategy(): 'always' | 'non-editable' | 'non-viewable' | 'none'

Returns

  • "always" | "non-editable" | "non-viewable" | "none" — See signature above.
Source: @univerjs/sheets-ui

getProtectedRangeShadowStrategy$

Signature

getProtectedRangeShadowStrategy$(): Observable<'always' | 'non-editable' | 'non-viewable' | 'none'>

Returns

  • Observable<"always" | "non-editable" | "non-viewable" | "none"> — See signature above.
Source: @univerjs/sheets-ui

getSheetHooks

Get sheet hooks.

Signature

getSheetHooks(): FSheetHooks

Returns

  • FSheetHooks — FSheetHooks instance
Source: @univerjs/sheets-ui

getSheetTarget

Signature

getSheetTarget(unitId: string, subUnitId: string): Nullable<{ workbook: FWorkbook; worksheet: FWorksheet }>

Parameters

  • unitId stringNo description
  • subUnitId stringNo description

Returns

  • Nullable<{ workbook: FWorkbook; worksheet: FWorksheet; }> — See signature above.
Source: @univerjs/sheets

getShortcut

Signature

getShortcut(): FShortcut

Returns

  • FShortcut — See signature above.
Source: @univerjs/ui

getUniverDoc

Signature

getUniverDoc(id: string): FDocument | null

Parameters

  • id stringNo description

Returns

  • FDocument — See signature above.
Source: @univerjs/docs-ui

getUniverSheet

Signature

getUniverSheet(id: string): FWorkbook | null

Parameters

  • id stringNo description

Returns

  • FWorkbook — See signature above.
Source: @univerjs/sheets

getURL

Signature

getURL(): URL

Returns

  • URL — See signature above.
Source: @univerjs/ui

getUserManager

Signature

getUserManager(): FUserManager

Returns

  • FUserManager — See signature above.
Source: @univerjs/core

getWorkbook

Signature

getWorkbook(id: string): FWorkbook | null

Parameters

  • id stringNo description

Returns

  • FWorkbook — See signature above.
Source: @univerjs/sheets

importDOCXToSnapshotAsync

Import DOCX file to document data

Signature

async importDOCXToSnapshotAsync(file: string | File): Promise<IDocumentData | undefined>

Parameters

  • file string | FileNo description

Returns

  • Promise<any> — See signature above.
Source: @univerjs-pro/exchange-client

importDOCXToUnitIdAsync

Import DOCX file to unit id

Signature

async importDOCXToUnitIdAsync(file: string | File): Promise<string | undefined>

Parameters

  • file string | FileNo description

Returns

  • Promise<string> — See signature above.
Source: @univerjs-pro/exchange-client

importXLSXToSnapshotAsync

Import XLSX file to workbook data

Signature

async importXLSXToSnapshotAsync(file: string | File): Promise<IWorkbookData | undefined>

Parameters

  • file string | FileNo description

Returns

  • Promise<any> — See signature above.
Source: @univerjs-pro/exchange-client

importXLSXToUnitIdAsync

Import XLSX file to unit id

Signature

async importXLSXToUnitIdAsync(file: string | File): Promise<string | undefined>

Parameters

  • file string | FileNo description

Returns

  • Promise<string> — See signature above.
Source: @univerjs-pro/exchange-client

isUIVisible

Signature

isUIVisible(ui: BuiltInUIPart): boolean

Parameters

  • ui BuiltInUIPartNo description

Returns

  • boolean — See signature above.
Source: @univerjs/ui

loadLocales

Load locales for the given locale.

Signature

loadLocales(locale: string, locales: ILanguagePack): void

Parameters

  • locale stringNo description
  • locales ILanguagePackNo description

Examples

univerAPI.loadLocales('esES', {
  'Hello World': 'Hola Mundo',
});
Source: @univerjs/core

loadServerUnit

Signature

loadServerUnit(unitId: string, unitType: UniverInstanceType, subUnitId?: string): Promise<UnitModel | null>

Parameters

  • unitId stringNo description
  • unitType UniverInstanceTypeNo description
  • subUnitId string (optional)No description

Returns

  • Promise<any> — See signature above.
Source: @univerjs-pro/collaboration-client

loadServerUnitOfRevision

Signature

loadServerUnitOfRevision(unitId: string, unitType: UniverInstanceType, rev: number): Promise<UnitModel | null>

Parameters

  • unitId stringNo description
  • unitType UniverInstanceTypeNo description
  • rev numberNo description

Returns

  • Promise<any> — See signature above.
Source: @univerjs-pro/collaboration-client

onAfterCellEdit

Signature

onAfterCellEdit(callback: (params: IEditorBridgeServiceVisibleParam) => void): IDisposable

Parameters

  • callback (params: IEditorBridgeServiceVisibleParam) => voidNo description

Returns

  • IDisposable — See signature above.
Source: @univerjs/sheets-ui

onBeforeCellEdit

Signature

onBeforeCellEdit(callback: (params: IEditorBridgeServiceVisibleParam) => void): IDisposable

Parameters

  • callback (params: IEditorBridgeServiceVisibleParam) => voidNo description

Returns

  • IDisposable — See signature above.
Source: @univerjs/sheets-ui

onBeforeCommandExecute

Deprecated — use univerAPI.addEvent(univerAPI.Event.BeforeCommandExecute, (event) =&gt; &#123;&#125;) instead.

Register a callback that will be triggered before invoking a command.

Signature

onBeforeCommandExecute(callback: CommandListener): IDisposable

Parameters

  • callback CommandListenerNo description

Returns

  • IDisposable — The disposable instance.
Source: @univerjs/core

onBeforeCopy

Signature

onBeforeCopy(callback: () => void): IDisposable

Parameters

  • callback () => voidNo description

Returns

  • IDisposable — See signature above.
Source: @univerjs/ui

onBeforePaste

Signature

onBeforePaste(callback: () => void): IDisposable

Parameters

  • callback () => voidNo description

Returns

  • IDisposable — See signature above.
Source: @univerjs/ui

onCellDragOver

Signature

onCellDragOver(callback: (cellPos: Nullable<IDragCellPosition>) => void): IDisposable

Parameters

  • callback (cellPos: any) => voidNo description

Returns

  • IDisposable — See signature above.
Source: @univerjs/sheets-ui

onCellDrop

Signature

onCellDrop(callback: (cellPos: Nullable<IDragCellPosition>) => void): IDisposable

Parameters

  • callback (cellPos: any) => voidNo description

Returns

  • IDisposable — See signature above.
Source: @univerjs/sheets-ui

onCellPointerMove

Signature

onCellPointerMove(callback: (cellPos: Nullable<IHoverCellPosition>) => void): IDisposable

Parameters

  • callback (cellPos: any) => voidNo description

Returns

  • IDisposable — See signature above.
Source: @univerjs/sheets-ui

onCellPointerOver

Signature

onCellPointerOver(callback: (cellPos: Nullable<IHoverCellPosition>) => void): IDisposable

Parameters

  • callback (cellPos: any) => voidNo description

Returns

  • IDisposable — See signature above.
Source: @univerjs/sheets-ui

onCellRender

Signature

onCellRender(customRender: Nullable<ICellCustomRender[]>, effect: InterceptorEffectEnum = InterceptorEffectEnum.Style, priority: number = InterceptCellContentPriority.DATA_VALIDATION): IDisposable

Parameters

  • customRender Nullable<ICellCustomRender[]>No description
  • effect InterceptorEffectEnum (optional)No description
  • priority number (optional)No description

Returns

  • IDisposable — See signature above.
Source: @univerjs/sheets-ui

onCommandExecuted

Deprecated — use univerAPI.addEvent(univerAPI.Event.CommandExecuted, (event) =&gt; &#123;&#125;) instead.

Register a callback that will be triggered when a command is invoked.

Signature

onCommandExecuted(callback: CommandListener): IDisposable

Parameters

  • callback CommandListenerNo description

Returns

  • IDisposable — The disposable instance.
Source: @univerjs/core

onCopy

Signature

onCopy(callback: () => void): IDisposable

Parameters

  • callback () => voidNo description

Returns

  • IDisposable — See signature above.
Source: @univerjs/ui

onPaste

Signature

onPaste(callback: () => void): IDisposable

Parameters

  • callback () => voidNo description

Returns

  • IDisposable — See signature above.
Source: @univerjs/ui

onUniverSheetCreated

Signature

onUniverSheetCreated(callback: (workbook: FWorkbook) => void): IDisposable

Parameters

  • callback (workbook: FWorkbook) => voidNo description

Returns

  • IDisposable — See signature above.
Source: @univerjs/sheets

openDialog

Signature

openDialog(dialog: IDialogPartMethodOptions): IDisposable

Parameters

  • dialog IDialogPartMethodOptionsNo description

Returns

  • IDisposable — See signature above.
Source: @univerjs/ui

openSidebar

Signature

openSidebar(params: ISidebarMethodOptions): IDisposable

Parameters

  • params ISidebarMethodOptionsNo description

Returns

  • IDisposable — See signature above.
Source: @univerjs/ui

openSiderbar

Signature

openSiderbar(params: ISidebarMethodOptions): IDisposable

Parameters

  • params ISidebarMethodOptionsNo description

Returns

  • IDisposable — See signature above.
Source: @univerjs/ui

paste

Signature

paste(): Promise<boolean>

Returns

  • Promise<boolean> — See signature above.
Source: @univerjs/ui

pasteIntoSheet

Signature

pasteIntoSheet(htmlContent?: string, textContent?: string, files?: File[]): Promise<boolean>

Parameters

  • htmlContent string (optional)No description
  • textContent string (optional)No description
  • files File[] (optional)No description

Returns

  • Promise<boolean> — See signature above.
Source: @univerjs/sheets-ui

registerComponent

Signature

registerComponent(name: string, component: any, options?: IComponentOptions): IDisposable

Parameters

  • name stringNo description
  • component anyNo description
  • options IComponentOptions (optional)No description

Returns

  • IDisposable — See signature above.
Source: @univerjs/ui

registerFunction

Signature

registerFunction(config: IRegisterFunctionParams): IDisposable

Parameters

  • config IRegisterFunctionParamsNo description

Returns

  • IDisposable — See signature above.
Source: @univerjs/sheets-formula

registerSheetColumnHeaderExtension

Signature

registerSheetColumnHeaderExtension(unitId: string, ...extensions: SheetExtension[]): IDisposable

Parameters

  • unitId stringNo description
  • extensions SheetExtension[]No description

Returns

  • IDisposable — See signature above.
Source: @univerjs/sheets-ui

registerSheetMainExtension

Signature

registerSheetMainExtension(unitId: string, ...extensions: SheetExtension[]): IDisposable

Parameters

  • unitId stringNo description
  • extensions SheetExtension[]No description

Returns

  • IDisposable — See signature above.
Source: @univerjs/sheets-ui

registerSheetRowHeaderExtension

Signature

registerSheetRowHeaderExtension(unitId: string, ...extensions: SheetExtension[]): IDisposable

Parameters

  • unitId stringNo description
  • extensions SheetExtension[]No description

Returns

  • IDisposable — See signature above.
Source: @univerjs/sheets-ui

registerUIPart

Signature

registerUIPart(key: BuiltInUIPart, component: any): IDisposable

Parameters

  • key BuiltInUIPartNo description
  • component anyNo description

Returns

  • IDisposable — See signature above.
Source: @univerjs/ui

registerURLImageDownloader

Signature

registerURLImageDownloader(downloader: (url: string) => Promise<string>): IDisposable

Parameters

  • downloader (url: string) => Promise<string>No description

Returns

  • IDisposable — See signature above.
Source: @univerjs/sheets-drawing-ui

runOnServer

Signature

runOnServer(scriptNameOrId: string, func: string, ...params: any[]): Promise<string>

Parameters

  • scriptNameOrId stringNo description
  • func stringNo description
  • params any[]No description

Returns

  • Promise<string> — See signature above.
Source: @univerjs-pro/collaboration-client-ui

setCrosshairHighlightColor

Signature

setCrosshairHighlightColor(color: string): FUniver

Parameters

  • color stringNo description

Returns

  • FUniver — See signature above.
Source: @univerjs/sheets-crosshair-highlight

setCrosshairHighlightEnabled

Signature

setCrosshairHighlightEnabled(enabled: boolean): FUniver

Parameters

  • enabled booleanNo description

Returns

  • FUniver — See signature above.
Source: @univerjs/sheets-crosshair-highlight

setCurrent

Signature

setCurrent(unitId: string): void

Parameters

  • unitId stringNo description
Source: @univerjs/ui

setFreezeSync

Signature

setFreezeSync(enabled: boolean): void

Parameters

  • enabled booleanNo description
Source: @univerjs/sheets

setPermissionDialogVisible

Signature

setPermissionDialogVisible(visible: boolean): void

Parameters

  • visible booleanNo description
Source: @univerjs/sheets-ui

setProtectedRangeShadowStrategy

Signature

setProtectedRangeShadowStrategy(strategy: 'always' | 'non-editable' | 'non-viewable' | 'none'): void

Parameters

  • strategy "always" | "non-editable" | "non-viewable" | "none"No description
Source: @univerjs/sheets-ui

setUIVisible

Signature

setUIVisible(ui: BuiltInUIPart, visible: boolean): FUniver

Parameters

  • ui BuiltInUIPartNo description
  • visible booleanNo description

Returns

  • FUniver — See signature above.
Source: @univerjs/ui

showMessage

Signature

showMessage(options: IMessageProps): FUniver

Parameters

  • options IMessagePropsNo description

Returns

  • FUniver — See signature above.
Source: @univerjs/ui

showRangeSelectorDialog

Signature

showRangeSelectorDialog(opts: IShowRangeSelectorDialogOptions): Promise<IUnitRangeName[]>

Parameters

  • opts IShowRangeSelectorDialogOptionsNo description

Returns

  • Promise<IUnitRangeName[]> — See signature above.
Source: @univerjs/sheets-formula-ui

startFollowing

Signature

startFollowing(): void
Source: @univerjs-pro/live-share

startPresenting

Signature

startPresenting(): void
Source: @univerjs-pro/live-share

stopFollowing

Signature

stopFollowing(): void
Source: @univerjs-pro/live-share

stopPresenting

Signature

stopPresenting(): void
Source: @univerjs-pro/live-share

validateMCPToolCall

Signature

validateMCPToolCall(toolName: string, params: unknown): { isValid: boolean; error?: string; validatedParams?: any }

Parameters

  • toolName stringNo description
  • params unknownNo description

Returns

  • { isValid: boolean; error?: string; validatedParams?: any; } — See signature above.
Source: @univerjs-labs/mcp

Table of Contents

Overview
@univerjs/core
@univerjs/docs-ui
@univerjs/engine-formula
@univerjs/network
@univerjs/sheets
@univerjs/sheets-crosshair-highlight
@univerjs/sheets-data-validation
@univerjs/sheets-drawing-ui
@univerjs/sheets-find-replace
@univerjs/sheets-formula
@univerjs/sheets-formula-ui
@univerjs/sheets-thread-comment
@univerjs/sheets-ui
@univerjs/ui
@univerjs/watermark
@univerjs-pro/collaboration-client
@univerjs-pro/collaboration-client-ui
@univerjs-pro/exchange-client
@univerjs-pro/live-share
@univerjs-labs/local-snapshot-manager
@univerjs-labs/mcp
@univerjs-labs/sheets-mcp
APIs
Creation & Bootstrap
createMenu
createSocket
createSubmenu
createTextFinderAsync
createUniverDoc
createUniverSheet
createWorkbook
disposeUnit
newAPI
Unit & Workbook
getActiveWorkbook
Commands
executeCommand
redo
syncExecuteCommand
undo
Events
addEvent
fireEvent
registerEventHandler
Factories
newBlob
newDataValidation
newDefinedName
newParagraphStyle
newParagraphStyleValue
newRichText
newRichTextValue
newTextDecoration
newTextStyle
newTextStyleValue
newTheadComment
Environment
setLocale
toggleDarkMode
Miscellaneous
addFonts
addWatermark
callMCPTool
connectMCP
copy
customizeColumnHeader
customizeRowHeader
deleteWatermark
disconnectMCP
exportDOCXBySnapshotAsync
exportDOCXByUnitIdAsync
exportXLSXBySnapshotAsync
exportXLSXByUnitIdAsync
extend
getActiveDocument
getActiveSheet
getActiveUniverSheet
getAllMCPTools
getCollaboration
getCommandSheetTarget
getComponentManager
getCrosshairHighlightColor
getCrosshairHighlightEnabled
getCurrentLifecycleStage
getFormula
getHooks
getLintErrors
getLiveShareStatus
getLocalSnapshotManager
getMCPConnectionStatus
getNetwork
getProtectedRangeShadowStrategy
getProtectedRangeShadowStrategy$
getSheetHooks
getSheetTarget
getShortcut
getUniverDoc
getUniverSheet
getURL
getUserManager
getWorkbook
importDOCXToSnapshotAsync
importDOCXToUnitIdAsync
importXLSXToSnapshotAsync
importXLSXToUnitIdAsync
isUIVisible
loadLocales
loadServerUnit
loadServerUnitOfRevision
onAfterCellEdit
onBeforeCellEdit
onBeforeCommandExecute
onBeforeCopy
onBeforePaste
onCellDragOver
onCellDrop
onCellPointerMove
onCellPointerOver
onCellRender
onCommandExecuted
onCopy
onPaste
onUniverSheetCreated
openDialog
openSidebar
openSiderbar
paste
pasteIntoSheet
registerComponent
registerFunction
registerSheetColumnHeaderExtension
registerSheetMainExtension
registerSheetRowHeaderExtension
registerUIPart
registerURLImageDownloader
runOnServer
setCrosshairHighlightColor
setCrosshairHighlightEnabled
setCurrent
setFreezeSync
setPermissionDialogVisible
setProtectedRangeShadowStrategy
setUIVisible
showMessage
showRangeSelectorDialog
startFollowing
startPresenting
stopFollowing
stopPresenting
validateMCPToolCall
Capalyze