API Reference
@univerjs
@univerjs/facade
classes
Funiver

@univerjs/facade v0.4.2Docs


Class: FUniver

Constructors

new FUniver()

new FUniver(
   _injector, 
   _univerInstanceService, 
   _commandService): FUniver

Parameters

ParameterType
_injectorInjector
_univerInstanceServiceIUniverInstanceService
_commandServiceICommandService

Returns

FUniver

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:78 (opens in a new tab)

Properties

PropertyModifierTypeDefault valueDefined in
_injectorreadonlyInjectorundefinedsubmodules/univer/packages/facade/src/apis/facade.ts:79 (opens in a new tab)
BorderStylestatictypeof BorderStyleTypesBorderStyleTypessubmodules/univer/packages/facade/src/apis/facade.ts:74 (opens in a new tab)
WrapStrategystatictypeof WrapStrategyWrapStrategysubmodules/univer/packages/facade/src/apis/facade.ts:76 (opens in a new tab)

Methods

addWatermark()

addWatermark(type, config)

addWatermark(type, config): void

Adds a watermark to the unit. Supports both text and image watermarks based on the specified type.

Parameters
ParameterTypeDescription
typeTextThe type of watermark to add. Can be either 'Text' or 'Image'.
configITextWatermarkConfigThe configuration object for the watermark. - If the type is 'Text', the config should follow the ITextWatermarkConfig interface. - If the type is 'Image', the config should follow the IImageWatermarkConfig interface.
Returns

void

Throws

Throws an error if the watermark type is unknown.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:552 (opens in a new tab)

addWatermark(type, config)

addWatermark(type, config): void
Parameters
ParameterType
typeImage
configIImageWatermarkConfig
Returns

void

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:553 (opens in a new tab)


copy()

copy(): Promise<boolean>

Returns

Promise<boolean>

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:349 (opens in a new tab)


createSocket()

createSocket(url): ISocket

Set WebSocket URL for WebSocketService

Parameters

ParameterTypeDescription
urlstringWebSocket URL

Returns

ISocket

WebSocket instance

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:409 (opens in a new tab)


createUniverDoc()

createUniverDoc(data): FDocument

Create a new document and get the API handler of that document.

Parameters

ParameterTypeDescription
dataPartial<IDocumentData>The snapshot of the document.

Returns

FDocument

FDocument API instance.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:167 (opens in a new tab)


createUniverSheet()

createUniverSheet(data): FWorkbook

Create a new spreadsheet and get the API handler of that spreadsheet.

Parameters

ParameterTypeDescription
dataPartial<IWorkbookData>The snapshot of the spreadsheet.

Returns

FWorkbook

FWorkbook API instance.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:156 (opens in a new tab)


customizeColumnHeader()

customizeColumnHeader(cfg): void

Customize the column header of the spreadsheet.

Parameters

ParameterTypeDescription
cfgIColumnsHeaderCfgParamThe configuration of the column header.

Returns

void

Example

customizeColumnHeader({ headerStyle: { backgroundColor: 'pink', fontSize: 9 }, columnsCfg: ['MokaII', undefined, null, { text: 'Size', textAlign: 'left' }] });

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:474 (opens in a new tab)


customizeRowHeader()

customizeRowHeader(cfg): void

Customize the row header of the spreadsheet.

Parameters

ParameterTypeDescription
cfgIRowsHeaderCfgParamThe configuration of the row header.

Returns

void

Example

customizeRowHeader({ headerStyle: { backgroundColor: 'pink', fontSize: 9 }, rowsCfg: ['MokaII', undefined, null, { text: 'Size', textAlign: 'left' }] });

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:495 (opens in a new tab)


deleteWatermark()

deleteWatermark(): void

Deletes the currently applied watermark from the unit.

This function retrieves the watermark service and invokes the method to remove any existing watermark configuration.

Returns

void

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:589 (opens in a new tab)


disposeUnit()

disposeUnit(unitId): boolean

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

Parameters

ParameterTypeDescription
unitIdstringThe unit id of the UniverSheet.

Returns

boolean

Whether the Univer instance is disposed successfully.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:178 (opens in a new tab)


executeCommand()

executeCommand<P, R>(
   id, 
   params?, 
options?): Promise<R>

Execute command

Type Parameters

Type ParameterDefault type
P extends objectobject
Rboolean

Parameters

ParameterTypeDescription
idstringCommand ID
params?PCommand parameters
options?IExecutionOptionsCommand execution options

Returns

Promise<R>

Command execution result

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:395 (opens in a new tab)


getActiveDocument()

getActiveDocument(): null | FDocument

Get the currently focused Univer document.

Returns

null | FDocument

The currently focused Univer document.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:231 (opens in a new tab)


getActiveWorkbook()

getActiveWorkbook(): null | FWorkbook

Get the currently focused Univer spreadsheet.

Returns

null | FWorkbook

The currently focused Univer spreadsheet.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:217 (opens in a new tab)


getCurrentLifecycleStage()

getCurrentLifecycleStage(): LifecycleStages

Get the current lifecycle stage.

Returns

LifecycleStages

  • The current lifecycle stage.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:324 (opens in a new tab)


getFormula()

getFormula(): FFormula

Returns

FFormula

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:315 (opens in a new tab)


getHooks()

getHooks(): FHooks

Get hooks

Returns

FHooks

FHooks instance

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:434 (opens in a new tab)


getPermission()

getPermission(): FPermission

Get the PermissionInstance.

Returns

FPermission

  • The PermissionInstance.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:537 (opens in a new tab)


getSheetHooks()

getSheetHooks(): FSheetHooks

Get sheet hooks

Returns

FSheetHooks

FSheetHooks instance

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:425 (opens in a new tab)


getUniverDoc()

getUniverDoc(id): null | FDocument

Get the document API handler by the document id.

Parameters

ParameterTypeDescription
idstringThe document id.

Returns

null | FDocument

The document API instance.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:203 (opens in a new tab)


getUniverSheet()

getUniverSheet(id): null | FWorkbook

Get the spreadsheet API handler by the spreadsheet id.

Parameters

ParameterTypeDescription
idstringThe spreadsheet id.

Returns

null | FWorkbook

The spreadsheet API instance.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:188 (opens in a new tab)


onBeforeCommandExecute()

onBeforeCommandExecute(callback): IDisposable

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

Parameters

ParameterTypeDescription
callbackCommandListenerThe callback.

Returns

IDisposable

The disposable instance.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:367 (opens in a new tab)


onCommandExecuted()

onCommandExecuted(callback): IDisposable

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

Parameters

ParameterTypeDescription
callbackCommandListenerThe callback.

Returns

IDisposable

The disposable instance.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:379 (opens in a new tab)


paste()

paste(): Promise<boolean>

Returns

Promise<boolean>

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:353 (opens in a new tab)


redo()

redo(): Promise<boolean>

Redo an editing on the currently focused document.

Returns

Promise<boolean>

redo result

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:345 (opens in a new tab)


registerFunction()

registerFunction(config): IDisposable

Register a function to the spreadsheet.

Parameters

ParameterTypeDescription
configIRegisterFunctionParamsThe configuration of the function.

Returns

IDisposable

The disposable instance.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:246 (opens in a new tab)


registerSheetColumnHeaderExtension()

registerSheetColumnHeaderExtension(unitId, ...extensions): IDisposable

Register sheet column header render extensions.

Parameters

ParameterTypeDescription
unitIdstringThe unit id of the spreadsheet.
...extensionsSheetExtension[]The extensions to register.

Returns

IDisposable

The disposable instance.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:288 (opens in a new tab)


registerSheetMainExtension()

registerSheetMainExtension(unitId, ...extensions): IDisposable

Register sheet main render extensions.

Parameters

ParameterTypeDescription
unitIdstringThe unit id of the spreadsheet.
...extensionsSheetExtension[]The extensions to register.

Returns

IDisposable

The disposable instance.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:305 (opens in a new tab)


registerSheetRowHeaderExtension()

registerSheetRowHeaderExtension(unitId, ...extensions): IDisposable

Register sheet row header render extensions.

Parameters

ParameterTypeDescription
unitIdstringThe unit id of the spreadsheet.
...extensionsSheetExtension[]The extensions to register.

Returns

IDisposable

The disposable instance.

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:271 (opens in a new tab)


setCrosshairHighlightColor()

setCrosshairHighlightColor(color): void

Set the color of the crosshair highlight.

Parameters

ParameterTypeDescription
colorstringthe color of the crosshair highlight

Returns

void

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:524 (opens in a new tab)


setCrosshairHighlightEnabled()

setCrosshairHighlightEnabled(enabled): void

Enable or disable crosshair highlight.

Parameters

ParameterTypeDescription
enabledbooleanif crosshair highlight should be enabled

Returns

void

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:512 (opens in a new tab)


undo()

undo(): Promise<boolean>

Undo an editing on the currently focused document.

Returns

Promise<boolean>

undo result

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:336 (opens in a new tab)


getDependencies()

protected static getDependencies(injector, derivedDependencies?): Dependency[]

Get dependencies for FUniver, you can override newAPI to add more dependencies.

Parameters

ParameterTypeDescription
injectorInjectorThe injector instance used to retrieve dependencies.
derivedDependencies?[]Optional array of pre-derived dependencies.

Returns

Dependency[]

  • An array of dependencies required by the service.

Static

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:116 (opens in a new tab)


newAPI()

static newAPI(wrapped): FUniver

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

Parameters

ParameterTypeDescription
wrappedInjector | UniverThe Univer instance or injector instance.

Returns

FUniver

  • The FUniver instance.

Static

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:134 (opens in a new tab)


newDataValidation()

static newDataValidation(): FDataValidationBuilder

Returns

FDataValidationBuilder

Defined in

submodules/univer/packages/facade/src/apis/facade.ts:141 (opens in a new tab)


Copyright © 2021-2024 DreamNum Co,Ltd. All Rights Reserved.