univerAPI
| Packages | @univerjs/core, @univerjs/ui, @univerjs/watermark, @univerjs/network, @univerjs/sheets-find-replace, @univerjs/docs, @univerjs/sheets, @univerjs/sheets-ui, @univerjs/thread-comment, @univerjs-pro/exchange-client, @univerjs-pro/bases-exchange-client, @univerjs-pro/boards-exchange-client, @univerjs-pro/docs-exchange-client, @univerjs-pro/pdfs-exchange-client, @univerjs-pro/sheets-exchange-client, @univerjs-pro/slides-exchange-client, @univerjs-pro/collaboration-client, @univerjs/sheets-crosshair-highlight, @univerjs/engine-formula, @univerjs-pro/live-share, @univerjs/sheets-data-validation, @univerjs/sheets-thread-comment, @univerjs/sheets-formula, @univerjs/sheets-drawing-ui, @univerjs-pro/collaboration-client-ui, @univerjs/sheets-formula-ui, @univerjs-pro/edit-history |
|---|
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
univerAPIinstead.
Overview
@univerjs/core
| Method | Description |
|---|---|
addEvent | Add an event listener |
disposeUnit | Dispose the UniverSheet by the unitId |
executeCommand | Execute a command with the given id and parameters |
extend | - |
fireEvent | Fire an event, used in internal only |
getCurrentLifecycleStage | Get the current lifecycle stage |
getCurrentLocale | Get the current locale |
getCurrentRegion | Get the current region used by locale-sensitive behavior |
getCurrentTheme | Get the active theme |
getLocales | Get loaded locale messages |
isDarkMode | Check whether the active theme is dark |
getUserManager | - |
loadLocales | Load locales for the given locale |
newAPI | Create an FUniver instance, if the injector is not provided, it will create a new Univer instance |
newBlob | Create a new blob |
newParagraphStyle | Create a new paragraph style |
newParagraphStyleValue | Create a new paragraph style value |
newRichText | Create a new rich text |
newRichTextValue | Create a new rich text value |
newTextDecoration | Create a new text decoration |
newTextStyle | Create a new text style |
newTextStyleValue | Create a new text style value |
redo | Redo an editing on the currently focused document |
registerEventHandler | - |
setLocale | Set the current locale |
setRegion | Set the current region independently of the message locale |
setDirection | Set the runtime layout direction to ltr or rtl |
setTheme | Replace the active theme at runtime |
syncExecuteCommand | Execute a command with the given id and parameters synchronously |
toggleDarkMode | Toggle dark mode on or off |
undo | Undo an editing on the currently focused document |
@univerjs/docs
| Method | Description |
|---|---|
createDocument | Create a new document and return its facade wrapper |
getActiveDocument | - |
getDocument | - |
@univerjs/engine-formula
| Method | Description |
|---|---|
getFormula | - |
@univerjs/network
| Method | Description |
|---|---|
createSocket | - |
getNetwork | - |
@univerjs/sheets
| Method | Description |
|---|---|
createWorkbook | - |
getActiveSheet | - |
getActiveWorkbook | - |
getSheetCommandTarget | - |
getWorkbook | - |
setFreezeSync | - |
@univerjs/sheets-crosshair-highlight
| Method | Description |
|---|---|
getCrosshairHighlightEnabled | - |
setCrosshairHighlightEnabled | - |
@univerjs/sheets-data-validation
| Method | Description |
|---|---|
newDataValidation | - |
@univerjs/sheets-drawing-ui
| Method | Description |
|---|---|
registerURLImageDownloader | - |
@univerjs/sheets-find-replace
| Method | Description |
|---|---|
createTextFinderAsync | - |
@univerjs/sheets-formula-ui
| Method | Description |
|---|---|
showRangeSelectorDialog | - |
@univerjs/sheets-thread-comment
| Method | Description |
|---|---|
newTheadComment | - |
@univerjs/thread-comment
| Method | Description |
|---|---|
createCommentAsync | Create a root thread on a serialized product anchor |
replyCommentAsync | Add a reply to a loaded thread |
updateCommentAsync | Update root or reply content and attachments |
deleteCommentAsync | Delete one comment or a complete thread |
resolveCommentAsync | Resolve or reopen a thread |
getComments | Query locally loaded threads |
listCommentsAsync | Synchronize known threads and query them |
@univerjs/sheets-ui
@univerjs/ui
| Method | Description |
|---|---|
addFonts | - |
copy | - |
createMenu | - |
createSubmenu | - |
getComponentManager | - |
getShortcut | - |
getURL | - |
isUIVisible | - |
onBeforeCopy | - |
onBeforePaste | - |
onCopy | - |
onPaste | - |
openDialog | - |
openSidebar | - |
paste | - |
registerComponent | - |
registerUIPart | - |
setCurrent | - |
setRibbonType | Change the ribbon layout |
setUIVisible | - |
showMessage | - |
@univerjs/watermark
| Method | Description |
|---|---|
addWatermark | - |
deleteWatermark | - |
@univerjs-pro/collaboration-client
| Method | Description |
|---|---|
getCollaboration | - |
loadServerUnit | - |
loadServerUnitOfRevision | - |
@univerjs-pro/collaboration-client-ui
| Method | Description |
|---|---|
runOnServer | - |
@univerjs-pro/exchange-client
| Method | Description |
|---|---|
downloadFile | Trigger a browser download for a file or blob |
@univerjs-pro/edit-history
| Method | Description |
|---|---|
compareUnitData | Semantically compare two fully materialized unit snapshots with the registered product adapter |
prepareUnitComparison | Prepare a comparison once for repeated filtering, scopes, and pagination |
Import and export methods are registered by their host Facade entries:
| Package | Methods |
|---|---|
@univerjs-pro/bases-exchange-client | importBaseToUnitIdAsync, importBaseToSnapshotAsync, exportBaseByUnitIdAsync, exportBaseBySnapshotAsync, transformSnapshotJsonToBaseDataAsync, transformBaseDataToSnapshotJsonAsync |
@univerjs-pro/boards-exchange-client | exportBoardByUnitIdAsync, exportBoardBySnapshotAsync, transformSnapshotJsonToBoardDataAsync, transformBoardDataToSnapshotJsonAsync |
@univerjs-pro/docs-exchange-client | importDocToUnitIdAsync, importDocToSnapshotAsync, exportDocByUnitIdAsync, exportDocBySnapshotAsync, transformSnapshotJsonToDocumentDataAsync, transformDocumentDataToSnapshotJsonAsync |
@univerjs-pro/pdfs-exchange-client | importPdfToUnitIdAsync, importPdfToSnapshotAsync, exportPdfByUnitIdAsync, exportPdfBySnapshotAsync, transformSnapshotJsonToPdfDataAsync, transformPdfDataToSnapshotJsonAsync |
@univerjs-pro/sheets-exchange-client | importSheetToUnitIdAsync, importSheetToSnapshotAsync, exportSheetByUnitIdAsync, exportSheetBySnapshotAsync, transformSnapshotJsonToWorkbookDataAsync, transformWorkbookDataToSnapshotJsonAsync |
@univerjs-pro/slides-exchange-client | importSlideToUnitIdAsync, importSlideToSnapshotAsync, exportSlideByUnitIdAsync, exportSlideBySnapshotAsync, transformSnapshotJsonToSlideDataAsync, transformSlideDataToSnapshotJsonAsync |
@univerjs-pro/live-share
| Method | Description |
|---|---|
getLiveShareStatus | - |
startFollowing | - |
startPresenting | - |
stopFollowing | - |
stopPresenting | - |
Cross-product extensions
Locale, region, and direction
setLocale() switches loaded messages. Region and layout direction can be controlled independently:
univerAPI.setRegion('SG')univerAPI.setDirection('rtl')console.log(univerAPI.getCurrentRegion())Thread comments
Import the shared Facade entry once, then import the matching product Facade for anchor-specific helpers.
import '@univerjs/thread-comment/facade'const openComments = univerAPI.getComments({ resolved: false })await univerAPI.listCommentsAsync({ anchorKinds: [univerAPI.Enum.ThreadCommentAnchorKind.DOC_TEXT_RANGE],})listCommentsAsync() synchronizes thread IDs already known to the configured datasource; it is not a server-wide discovery API.
Semantic unit comparison
import { UnitComparisonFidelity } from '@univerjs-pro/edit-history'import '@univerjs-pro/edit-history/facade'const result = univerAPI.compareUnitData({ comparisonId: 'review-42', unitId: 'doc-1', type: univerAPI.Enum.UniverInstanceType.UNIVER_DOC, fidelity: UnitComparisonFidelity.SNAPSHOT, leftData, rightData,})Register the matching product History plugin before calling these methods. prepareUnitComparison(input) returns an FUnitComparison; its query() method accepts scope, filters, detail, and pagination without recomputing the comparison. The scopes array identifies product views. These APIs compare semantic content without merging snapshots or replaying mutations. See prepared and headless comparisons for limits, diagnostics, and Node.js usage.
APIs
Creation & Bootstrap
createMenu
Signature
createMenu(menuItem: IFacadeMenuItem): FMenuParameters
menuItemIFacadeMenuItem— No description
Returns
FMenu— See signature above.
@univerjs/ui
createSocket
Signature
createSocket(url: string): ISocketParameters
urlstring— No description
Returns
ISocket— See signature above.
@univerjs/network
createSubmenu
Signature
createSubmenu(submenuItem: IFacadeSubmenuItem): FSubmenuParameters
submenuItemIFacadeSubmenuItem— No description
Returns
FSubmenu— See signature above.
@univerjs/ui
createTextFinderAsync
Signature
async createTextFinderAsync(text: string): Promise<FTextFinder | null>Parameters
textstring— No description
Returns
Promise<FTextFinder>— See signature above.
@univerjs/sheets-find-replace
createDocument
Signature
createDocument(data: Partial<IDocumentData>): FDocumentParameters
dataPartial<IDocumentData>— Initial document data. Pass{}to create an empty document.
Returns
FDocument— The created document facade wrapper.
@univerjs/docs
createWorkbook
Signature
createWorkbook(data: Partial<IWorkbookData>, options?: ICreateUnitOptions): FWorkbookParameters
dataPartial<IWorkbookData>— No descriptionoptionsICreateUnitOptions(optional) — No description
Returns
FWorkbook— See signature above.
@univerjs/sheets
disposeUnit
Dispose the UniverSheet by the unitId. The UniverSheet would be unload from the application.
Signature
disposeUnit(unitId: string): booleanParameters
unitIdstring— No description
Returns
boolean— Whether the Univer instance is disposed successfully.
Examples
const fWorkbook = univerAPI.getActiveWorkbook()const unitId = fWorkbook?.getId()if (unitId) { univerAPI.disposeUnit(unitId)}@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): FUniverParameters
wrappedany— No description
Returns
FUniver— - The FUniver instance.
Tags
@static— *
Examples
const univerAPI = FUniver.newAPI(univer)@univerjs/core
Unit & Workbook
getActiveWorkbook
Signature
getActiveWorkbook(): FWorkbook | nullReturns
FWorkbook— See signature above.
@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
idstring— No descriptionparamsP(optional) — No descriptionoptionsIExecutionOptions(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 },})@univerjs/core
redo
Redo an editing on the currently focused document.
Signature
redo(): Promise<boolean>Returns
Promise<boolean>— redo result
Examples
await univerAPI.redo()@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): RParameters
idstring— No descriptionparamsP(optional) — No descriptionoptionsIExecutionOptions(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 },})@univerjs/core
undo
Undo an editing on the currently focused document.
Signature
undo(): Promise<boolean>Returns
Promise<boolean>— undo result
Examples
await univerAPI.undo()@univerjs/core
Events
addEvent
Add an event listener
Signature
addEvent<T extends keyof IEventParamConfig>(event: T, callback: (params: IEventParamConfig[T]) => void): IDisposableParameters
eventT— No descriptioncallback(params: IEventParamConfig[T]) => void— when event triggered
Returns
IDisposable— The Disposable instance, for remove the listener
Examples
// Add life cycle changed event listenerconst disposable = univerAPI.addEvent(univerAPI.Event.LifeCycleChanged, (params) => { const { stage } = params console.log('life cycle changed', params)})// Remove the event listener, use `disposable.dispose()`@univerjs/core
fireEvent
Fire an event, used in internal only.
Signature
fireEvent<T extends keyof IEventParamConfig>(event: T, params: IEventParamConfig[T]): boolean | undefinedParameters
eventT— No descriptionparamsIEventParamConfig[T]— of event
Returns
boolean— should cancel
Examples
this.fireEvent(univerAPI.Event.LifeCycleChanged, params)@univerjs/core
registerEventHandler
Signature
registerEventHandler: (event: string, handler: () => any) => IDisposableReturns
(event: string, handler: () => any) => IDisposable— See signature above.
@univerjs/core
Factories
newBlob
Create a new blob.
Signature
newBlob(): FBlobReturns
FBlob— The new blob instance
Examples
const blob = univerAPI.newBlob()@univerjs/core
newDataValidation
univerAPI.newDataValidation() as instead.Signature
static newDataValidation(): FDataValidationBuilderReturns
FDataValidationBuilder— A new instance of the FDataValidationBuilder class
@univerjs/sheets-data-validation
newParagraphStyle
Create a new paragraph style.
Signature
newParagraphStyle(style?: IParagraphStyle): ParagraphStyleBuilderParameters
styleIParagraphStyle(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)@univerjs/core
newParagraphStyleValue
Create a new paragraph style value.
Signature
newParagraphStyleValue(style?: IParagraphStyle): ParagraphStyleValueParameters
styleIParagraphStyle(optional) — No description
Returns
ParagraphStyleValue— The new paragraph style value instance
Examples
const paragraphStyleValue = univerAPI.newParagraphStyleValue()@univerjs/core
newRichText
Create a new rich text.
Signature
newRichText(data?: IDocumentData): RichTextBuilderParameters
dataIDocumentData(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)RichTextBuilder.link(text, url) appends linked text without offsets. Use getLinks() to obtain the link's range id and change its destination later.
const richText = univerAPI.newRichText().text('Read ').link('the guide', 'https://docs.univer.ai')const [link] = richText.getLinks()if (!link) throw new Error('Link was not created')richText.updateLink(link.rangeId, 'https://docs.univer.ai/guides')removeLink(id) removes the link destination but preserves its visible text.
@univerjs/core
newRichTextValue
Create a new rich text value.
Signature
newRichTextValue(data: IDocumentData): RichTextValueParameters
dataIDocumentData— No 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)@univerjs/core
newTextDecoration
Create a new text decoration.
Signature
newTextDecoration(decoration?: ITextDecoration): TextDecorationBuilderParameters
decorationITextDecoration(optional) — No description
Returns
TextDecorationBuilder— The new text decoration instance
Examples
const decoration = univerAPI.newTextDecoration()@univerjs/core
newTextStyle
Create a new text style.
Signature
newTextStyle(style?: ITextStyle): TextStyleBuilderParameters
styleITextStyle(optional) — No description
Returns
TextStyleBuilder— The new text style instance
Examples
const textStyle = univerAPI.newTextStyle()@univerjs/core
newTextStyleValue
Create a new text style value.
Signature
newTextStyleValue(style?: ITextStyle): TextStyleValueParameters
styleITextStyle(optional) — No description
Returns
TextStyleValue— The new text style value instance
Examples
const textStyleValue = univerAPI.newTextStyleValue()@univerjs/core
newTheadComment
Signature
newTheadComment(comment?: IThreadComment): FTheadCommentBuilderParameters
commentIThreadComment(optional) — No description
Returns
FTheadCommentBuilder— See signature above.
@univerjs/sheets-thread-comment
Environment
setLocale
Set the current locale.
Signature
setLocale(locale: string): voidParameters
localestring— No description
Examples
univerAPI.setLocale('esES')@univerjs/core
setTheme
Replace the active theme at runtime.
setTheme(theme: Theme): voidgetCurrentTheme
getCurrentTheme(): ThemeisDarkMode
isDarkMode(): booleanimport { darkBlueTheme } from '@univerjs/themes'univerAPI.setTheme(darkBlueTheme)console.log(univerAPI.isDarkMode(), univerAPI.getCurrentTheme())@univerjs/core
toggleDarkMode
Toggle dark mode on or off.
Signature
toggleDarkMode(isDarkMode: boolean): voidParameters
isDarkModeboolean— No description
Examples
univerAPI.toggleDarkMode(true)@univerjs/core
Miscellaneous
addFonts
Signature
addFonts(fonts: IFontConfig[]): voidParameters
fontsIFontConfig[]— No description
@univerjs/ui
addWatermark
Signature
addWatermark(type: IWatermarkTypeEnum.Text | IWatermarkTypeEnum.Image, config: ITextWatermarkConfig | IImageWatermarkConfig): FUniverParameters
typeIWatermarkTypeEnum.Text | IWatermarkTypeEnum.Image— No descriptionconfigITextWatermarkConfig | IImageWatermarkConfig— No description
Returns
FUniver— See signature above.
@univerjs/watermark
copy
Signature
copy(): Promise<boolean>Returns
Promise<boolean>— See signature above.
@univerjs/ui
customizeColumnHeader
Signature
customizeColumnHeader(cfg: IColumnsHeaderCfgParam): voidParameters
cfgIColumnsHeaderCfgParam— No description
@univerjs/sheets-ui
customizeRowHeader
Signature
customizeRowHeader(cfg: IRowsHeaderCfgParam): voidParameters
cfgIRowsHeaderCfgParam— No description
@univerjs/sheets-ui
deleteWatermark
Signature
deleteWatermark(): FUniverReturns
FUniver— See signature above.
@univerjs/watermark
downloadFile
Trigger a browser download for a file or blob.
Signature
downloadFile(file: File | Blob, filename: string, fileExt: string): voidParameters
fileFile | Blob— File or blob to download.filenamestring— Filename without extension.fileExtstring— File extension without a leading dot.
@univerjs-pro/exchange-client
exportDocBySnapshotAsync
Signature
exportDocBySnapshotAsync(snapshot: IDocumentData): Promise<File | undefined>Parameters
snapshotIDocumentData— No description
Returns
Promise<File>— See signature above.
@univerjs-pro/docs-exchange-client
exportDocByUnitIdAsync
Signature
exportDocByUnitIdAsync(unitId: string): Promise<File | undefined>Parameters
unitIdstring— No description
Returns
Promise<File>— See signature above.
@univerjs-pro/docs-exchange-client
exportSlideBySnapshotAsync
Export PPTX file by slide data
Signature
exportSlideBySnapshotAsync(snapshot: ISlideData): Promise<File | undefined>Parameters
snapshotISlideData— Slide data.
Returns
Promise<File>— See signature above.
@univerjs-pro/slides-exchange-client
exportSlideByUnitIdAsync
Export PPTX file by unit id
Signature
exportSlideByUnitIdAsync(unitId: string): Promise<File | undefined>Parameters
unitIdstring— The slide unit id.
Returns
Promise<File>— See signature above.
@univerjs-pro/slides-exchange-client
exportSheetBySnapshotAsync
Export XLSX file by workbook data
Signature
exportSheetBySnapshotAsync(snapshot: IWorkbookData, format?: ExchangeFormat, sheetId?: string): Promise<File | undefined>Parameters
snapshotIWorkbookData— No description
Returns
Promise<File>— See signature above.
@univerjs-pro/sheets-exchange-client
exportSheetByUnitIdAsync
Export XLSX file by unit id
Signature
exportSheetByUnitIdAsync(unitId: string, format?: ExchangeFormat, sheetId?: string): Promise<File | undefined>Parameters
unitIdstring— No description
Returns
Promise<File>— See signature above.
@univerjs-pro/sheets-exchange-client
extend
Signature
static extend(source: any): voidParameters
sourceany— No description
@univerjs/core
getActiveDocument
Signature
getActiveDocument(): FDocument | nullReturns
FDocument— See signature above.
@univerjs/docs
getActiveSheet
Signature
getActiveSheet(): Nullable<{ workbook: FWorkbook; worksheet: FWorksheet }>Returns
Nullable<{ workbook: FWorkbook; worksheet: FWorksheet; }>— See signature above.
@univerjs/sheets
getCollaboration
Signature
getCollaboration(): FCollaborationReturns
FCollaboration— See signature above.
@univerjs-pro/collaboration-client
getSheetCommandTarget
Signature
getSheetCommandTarget(params?: { unitId?: string; subUnitId?: string; sheetId?: string }): { workbook: FWorkbook; worksheet: FWorksheet; unitId: string; subUnitId: string } | nullParameters
params{ unitId?: string; subUnitId?: string; sheetId?: string }(optional) — Target identifiers.
Returns
{ workbook: FWorkbook; worksheet: FWorksheet; unitId: string; subUnitId: string } | null— See signature above.
@univerjs/sheets
getComponentManager
Signature
getComponentManager(): ComponentManagerReturns
ComponentManager— See signature above.
@univerjs/ui
getCrosshairHighlightEnabled
Signature
getCrosshairHighlightEnabled(): booleanReturns
boolean— See signature above.
@univerjs/sheets-crosshair-highlight
getCurrentLifecycleStage
Get the current lifecycle stage.
Signature
getCurrentLifecycleStage(): LifecycleStagesReturns
LifecycleStages— - The current lifecycle stage.
Examples
const stage = univerAPI.getCurrentLifecycleStage()console.log(stage)@univerjs/core
getCurrentLocale
Get the current locale.
Signature
getCurrentLocale(): stringReturns
string— The current locale.
Examples
const currentLocale = univerAPI.getCurrentLocale()@univerjs/core
getFormula
Signature
getFormula(): FFormulaReturns
FFormula— See signature above.
@univerjs/engine-formula
getLocales
Get loaded locale messages.
Signature
getLocales(): ILanguagePack | undefinedReturns
ILanguagePack | undefined— Loaded locale messages.
Examples
const locales = univerAPI.getLocales()@univerjs/core
getLiveShareStatus
Signature
getLiveShareStatus(): LiveShareStatusReturns
LiveShareStatus— See signature above.
@univerjs-pro/live-share
getNetwork
Signature
getNetwork(): FNetworkReturns
FNetwork— See signature above.
@univerjs/network
getProtectedRangeShadowStrategy
Signature
getProtectedRangeShadowStrategy(): 'always' | 'non-editable' | 'non-viewable' | 'none'Returns
"always" | "non-editable" | "non-viewable" | "none"— See signature above.
@univerjs/sheets-ui
getProtectedRangeShadowStrategy$
Signature
getProtectedRangeShadowStrategy$(): Observable<'always' | 'non-editable' | 'non-viewable' | 'none'>Returns
Observable<"always" | "non-editable" | "non-viewable" | "none">— See signature above.
@univerjs/sheets-ui
registerCellCustomRender
Register custom cell renderers. Dispose the returned handle to remove the interceptor.
Signature
registerCellCustomRender(customRender: Nullable<ICellCustomRender[]>, effect?: InterceptorEffectEnum, priority?: number): IDisposable@univerjs/sheets-ui
getShortcut
Signature
getShortcut(): FShortcutReturns
FShortcut— See signature above.
@univerjs/ui
getDocument
Signature
getDocument(id: string): FDocument | nullParameters
idstring— No description
Returns
FDocument— See signature above.
@univerjs/docs
getURL
Signature
getURL(): URLReturns
URL— See signature above.
@univerjs/ui
getUserManager
Signature
getUserManager(): FUserManagerReturns
FUserManager— See signature above.
@univerjs/core
getWorkbook
Signature
getWorkbook(id: string): FWorkbook | nullParameters
idstring— No description
Returns
FWorkbook— See signature above.
@univerjs/sheets
importDocToSnapshotAsync
Import DOCX file to document data
Signature
importDocToSnapshotAsync(file: File | string): Promise<IDocumentData | undefined>Parameters
filestring | File— No description
Returns
Promise<any>— See signature above.
@univerjs-pro/docs-exchange-client
importDocToUnitIdAsync
Import DOCX file to unit id
Signature
importDocToUnitIdAsync(file: File | string): Promise<string | undefined>Parameters
filestring | File— No description
Returns
Promise<string>— See signature above.
@univerjs-pro/docs-exchange-client
importSlideToSnapshotAsync
Import PPTX file to slide data
Signature
importSlideToSnapshotAsync(file: File | string): Promise<ISlideData | undefined>Parameters
fileFile | string— File object or URL.
Returns
Promise<ISlideData | undefined>— See signature above.
@univerjs-pro/slides-exchange-client
importSlideToUnitIdAsync
Import PPTX file to unit id
Signature
importSlideToUnitIdAsync(file: File | string): Promise<string | undefined>Parameters
fileFile | string— File object or URL.
Returns
Promise<string>— See signature above.
@univerjs-pro/slides-exchange-client
importSheetToSnapshotAsync
Import XLSX file to workbook data
Signature
importSheetToSnapshotAsync(file: File | string): Promise<IWorkbookData | undefined>Parameters
filestring | File— No description
Returns
Promise<any>— See signature above.
@univerjs-pro/sheets-exchange-client
importSheetToUnitIdAsync
Import XLSX file to unit id
Signature
importSheetToUnitIdAsync(file: File | string): Promise<string | undefined>Parameters
filestring | File— No description
Returns
Promise<string>— See signature above.
@univerjs-pro/sheets-exchange-client
isUIVisible
Signature
isUIVisible(ui: BuiltInUIPart): booleanParameters
uiBuiltInUIPart— No description
Returns
boolean— See signature above.
@univerjs/ui
loadLocales
Load locales for the given locale.
Signature
loadLocales(locale: string, locales: ILanguagePack): voidParameters
localestring— No descriptionlocalesILanguagePack— No description
Examples
univerAPI.loadLocales('esES', { 'Hello World': 'Hola Mundo',})@univerjs/core
loadServerUnit
Signature
loadServerUnit(unitId: string, unitType: UniverInstanceType, subUnitId?: string): Promise<UnitModel | null>Parameters
unitIdstring— No descriptionunitTypeUniverInstanceType— No descriptionsubUnitIdstring(optional) — No description
Returns
Promise<any>— See signature above.
@univerjs-pro/collaboration-client
loadServerUnitOfRevision
Signature
loadServerUnitOfRevision(unitId: string, unitType: UniverInstanceType, rev: number): Promise<UnitModel | null>Parameters
unitIdstring— No descriptionunitTypeUniverInstanceType— No descriptionrevnumber— No description
Returns
Promise<any>— See signature above.
@univerjs-pro/collaboration-client
onBeforeCopy
Signature
onBeforeCopy(callback: () => void): IDisposableParameters
callback() => void— No description
Returns
IDisposable— See signature above.
@univerjs/ui
onBeforePaste
Signature
onBeforePaste(callback: () => void): IDisposableParameters
callback() => void— No description
Returns
IDisposable— See signature above.
@univerjs/ui
onCopy
Signature
onCopy(callback: () => void): IDisposableParameters
callback() => void— No description
Returns
IDisposable— See signature above.
@univerjs/ui
onPaste
Signature
onPaste(callback: () => void): IDisposableParameters
callback() => void— No description
Returns
IDisposable— See signature above.
@univerjs/ui
openDialog
Signature
openDialog(dialog: IDialogPartMethodOptions): IDisposableParameters
dialogIDialogPartMethodOptions— No description
Returns
IDisposable— See signature above.
@univerjs/ui
openSidebar
Signature
openSidebar(params: ISidebarMethodOptions): IDisposableParameters
paramsISidebarMethodOptions— No description
Returns
IDisposable— See signature above.
@univerjs/ui
paste
Signature
paste(): Promise<boolean>Returns
Promise<boolean>— See signature above.
@univerjs/ui
pasteIntoSheet
Signature
pasteIntoSheet(htmlContent?: string, textContent?: string, files?: File[]): Promise<boolean>Parameters
htmlContentstring(optional) — No descriptiontextContentstring(optional) — No descriptionfilesFile[](optional) — No description
Returns
Promise<boolean>— See signature above.
@univerjs/sheets-ui
registerComponent
Signature
registerComponent(name: string, component: ComponentType, options?: IComponentOptions): IDisposableParameters
namestring— No descriptioncomponentComponentType— No descriptionoptionsIComponentOptions(optional) — No description
Returns
IDisposable— See signature above.
@univerjs/ui
registerSheetColumnHeaderExtension
Signature
registerSheetColumnHeaderExtension(unitId: string, ...extensions: SheetExtension[]): IDisposableParameters
unitIdstring— No descriptionextensionsSheetExtension[]— No description
Returns
IDisposable— See signature above.
@univerjs/sheets-ui
registerSheetMainExtension
Signature
registerSheetMainExtension(unitId: string, ...extensions: SheetExtension[]): IDisposableParameters
unitIdstring— No descriptionextensionsSheetExtension[]— No description
Returns
IDisposable— See signature above.
@univerjs/sheets-ui
registerSheetRowHeaderExtension
Signature
registerSheetRowHeaderExtension(unitId: string, ...extensions: SheetExtension[]): IDisposableParameters
unitIdstring— No descriptionextensionsSheetExtension[]— No description
Returns
IDisposable— See signature above.
@univerjs/sheets-ui
registerUIPart
Signature
registerUIPart(key: BuiltInUIPart, component: ComponentType): IDisposableParameters
keyBuiltInUIPart— No descriptioncomponentComponentType— No description
Returns
IDisposable— See signature above.
@univerjs/ui
registerURLImageDownloader
Signature
registerURLImageDownloader(downloader: (url: string) => Promise<string>): IDisposableParameters
downloader(url: string) => Promise<string>— No description
Returns
IDisposable— See signature above.
@univerjs/sheets-drawing-ui
runOnServer
Signature
runOnServer(scriptNameOrId: string, func: string, ...params: any[]): Promise<string>Parameters
scriptNameOrIdstring— No descriptionfuncstring— No descriptionparamsany[]— No description
Returns
Promise<string>— See signature above.
@univerjs-pro/collaboration-client-ui
setCrosshairHighlightEnabled
Signature
setCrosshairHighlightEnabled(enabled: boolean): FUniverParameters
enabledboolean— No description
Returns
FUniver— See signature above.
@univerjs/sheets-crosshair-highlight
setCurrent
Signature
setCurrent(unitId: string): voidParameters
unitIdstring— No description
@univerjs/ui
setFreezeSync
Signature
setFreezeSync(enabled: boolean): voidParameters
enabledboolean— No description
@univerjs/sheets
setPermissionDialogVisible
Signature
setPermissionDialogVisible(visible: boolean): voidParameters
visibleboolean— No description
@univerjs/sheets-ui
setProtectedRangeShadowStrategy
Signature
setProtectedRangeShadowStrategy(strategy: 'always' | 'non-editable' | 'non-viewable' | 'none'): voidParameters
strategy"always" | "non-editable" | "non-viewable" | "none"— No description
@univerjs/sheets-ui
setRibbonType
Signature
setRibbonType(ribbonType: 'collapsed' | 'simple' | 'classic' | 'grid'): FUniverChanges the current ribbon layout while preserving the rest of the UI plugin configuration.
Returns
FUniver— The current Facade instance for chaining.
@univerjs/ui
setUIVisible
Signature
setUIVisible(ui: BuiltInUIPart, visible: boolean): FUniverParameters
uiBuiltInUIPart— No descriptionvisibleboolean— No description
Returns
FUniver— See signature above.
@univerjs/ui
showMessage
Signature
showMessage(options: IMessageProps): FUniverParameters
optionsIMessageProps— No description
Returns
FUniver— See signature above.
@univerjs/ui
showRangeSelectorDialog
Signature
showRangeSelectorDialog(opts: IShowRangeSelectorDialogOptions): Promise<IUnitRangeName[]>Parameters
optsIShowRangeSelectorDialogOptions— No description
Returns
Promise<IUnitRangeName[]>— See signature above.
@univerjs/sheets-formula-ui
startFollowing
Signature
startFollowing(): void@univerjs-pro/live-share
startPresenting
Signature
startPresenting(): void@univerjs-pro/live-share
stopFollowing
Signature
stopFollowing(): void@univerjs-pro/live-share
stopPresenting
Signature
stopPresenting(): void@univerjs-pro/live-share
transformSnapshotJsonToWorkbookDataAsync
Transform snapshot JSON returned by the exchange service to workbook data.
Signature
transformSnapshotJsonToWorkbookDataAsync(json: ISnapshotBlockJsonResponse): Promise<IWorkbookData>Parameters
jsonISnapshotBlockJsonResponse— Snapshot JSON returned by the exchange service.
Returns
Promise<IWorkbookData>— Workbook data.
@univerjs-pro/sheets-exchange-client
transformWorkbookDataToSnapshotJsonAsync
Transform workbook data to snapshot JSON accepted by the exchange service.
Signature
transformWorkbookDataToSnapshotJsonAsync(workbookData: IWorkbookData): Promise<ISnapshotBlockJson>Parameters
workbookDataIWorkbookData— Workbook data.
Returns
Promise<ISnapshotBlockJson>— Snapshot JSON accepted by the exchange service.
@univerjs-pro/sheets-exchange-clientHow is this guide?