API Reference
@univerjs
@univerjs/facade
classes
Fworkbook

@univerjs/facade v0.4.2Docs


Class: FWorkbook

Constructors

new FWorkbook()

new FWorkbook(
   _workbook, 
   _injector, 
   _resourceLoaderService, 
   _selectionManagerService, 
   _univerInstanceService, 
   _commandService, 
   _permissionService, 
   _logService): FWorkbook

Parameters

ParameterType
_workbookWorkbook
_injectorInjector
_resourceLoaderServiceIResourceLoaderService
_selectionManagerServiceSheetsSelectionsService
_univerInstanceServiceIUniverInstanceService
_commandServiceICommandService
_permissionServiceIPermissionService
_logServiceILogService

Returns

FWorkbook

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:62 (opens in a new tab)

Properties

PropertyModifierTypeDefined in
_injectorreadonlyInjectorsubmodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:64 (opens in a new tab)
idreadonlystringsubmodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:60 (opens in a new tab)

Methods

create()

create(
   name, 
   rows, 
   column): FWorksheet

Create a new worksheet and returns a handle to it.

Parameters

ParameterTypeDescription
namestringName of the new sheet
rowsnumberHow may rows would the new sheet have
columnnumberHow many columns would the new sheet have

Returns

FWorksheet

The new created sheet

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:136 (opens in a new tab)


createSheetHyperlink()

createSheetHyperlink(sheetId, range?): string

create a hyperlink for the sheet

Parameters

ParameterTypeDescription
sheetIdstringthe sheet id to link
range?string | IRangethe range to link, or define-name id

Returns

string

the hyperlink string

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:609 (opens in a new tab)


deleteSheet()

deleteSheet(sheet): void

Deletes the specified worksheet.

Parameters

ParameterTypeDescription
sheetFWorksheetThe worksheet to delete.

Returns

void

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:229 (opens in a new tab)


getActiveRange()

getActiveRange(): null | FRange

Returns the selected range in the active sheet, or null if there is no active range.

Returns

null | FRange

the active range

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:384 (opens in a new tab)


getActiveSheet()

getActiveSheet(): FWorksheet

Get the active sheet of the workbook.

Returns

FWorksheet

The active sheet of the workbook

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:114 (opens in a new tab)


getId()

getId(): string

Returns

string

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:84 (opens in a new tab)


getName()

getName(): string

Returns

string

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:88 (opens in a new tab)


getSheetByName()

getSheetByName(name): null | FWorksheet

Get a worksheet by sheet name.

Parameters

ParameterTypeDescription
namestringThe name of the sheet to get.

Returns

null | FWorksheet

The worksheet with given sheet name

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:179 (opens in a new tab)


getSheetBySheetId()

getSheetBySheetId(sheetId): null | FWorksheet

Get a worksheet by sheet id.

Parameters

ParameterTypeDescription
sheetIdstringThe id of the sheet to get.

Returns

null | FWorksheet

The worksheet with given sheet id

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:165 (opens in a new tab)


getSheets()

getSheets(): FWorksheet[]

Gets all the worksheets in this workbook

Returns

FWorksheet[]

An array of all the worksheets in the workbook

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:123 (opens in a new tab)


getSnapshot()

getSnapshot(): IWorkbookData

Returns

IWorkbookData

{IWorkbookData}

Deprecated

use 'save' instead.

Memberof

FWorkbook

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:105 (opens in a new tab)


getValidatorStatus()

getValidatorStatus(): Promise<Record<string, ObjectMatrix<Nullable<IDataValidationResCache>>>>

get data validation validator status for current workbook

Returns

Promise<Record<string, ObjectMatrix<Nullable<IDataValidationResCache>>>>

matrix of validator status

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:344 (opens in a new tab)


insertSheet()

insertSheet(): FWorksheet

Inserts a new worksheet into the workbook. Using a default sheet name. The new sheet becomes the active sheet

Returns

FWorksheet

The new sheet

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:207 (opens in a new tab)


navigateToSheetHyperlink()

navigateToSheetHyperlink(hyperlink): void

navigate to the sheet hyperlink

Parameters

ParameterTypeDescription
hyperlinkstringthe hyperlink string

Returns

void

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:628 (opens in a new tab)


onBeforeAddDataValidation()

onBeforeAddDataValidation(callback): IDisposable

The onBeforeAddDataValidation event is fired before the data validation rule is added.

Parameters

ParameterTypeDescription
callback(params, options) => false | voidCallback function that will be called when the event is fired

Returns

IDisposable

A disposable object that can be used to unsubscribe from the event

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:419 (opens in a new tab)


onBeforeAddThreadComment()

onBeforeAddThreadComment(callback): IDisposable

The onThreadCommentChange event is fired when the thread comment of this sheet is changed.

Parameters

ParameterTypeDescription
callback(params, options) => false | voidCallback function that will be called when the event is fired

Returns

IDisposable

A disposable object that can be used to unsubscribe from the event

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:548 (opens in a new tab)


onBeforeCommandExecute()

onBeforeCommandExecute(callback): IDisposable

Register a callback that will be triggered before invoking a command targeting the Univer sheet.

Parameters

ParameterTypeDescription
callbackCommandListenerthe callback.

Returns

IDisposable

A function to dispose the listening.

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:283 (opens in a new tab)


onBeforeDeleteAllDataValidation()

onBeforeDeleteAllDataValidation(callback): IDisposable

The onBeforeDeleteAllDataValidation event is fired before delete all data validation rules.

Parameters

ParameterTypeDescription
callback(params, options) => false | voidCallback function that will be called when the event is fired

Returns

IDisposable

A disposable object that can be used to unsubscribe from the event

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:517 (opens in a new tab)


onBeforeDeleteDataValidation()

onBeforeDeleteDataValidation(callback): IDisposable

The onBeforeDeleteDataValidation event is fired before the data validation rule is deleted.

Parameters

ParameterTypeDescription
callback(params, options) => false | voidCallback function that will be called when the event is fired

Returns

IDisposable

A disposable object that can be used to unsubscribe from the event

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:498 (opens in a new tab)


onBeforeDeleteThreadComment()

onBeforeDeleteThreadComment(callback): IDisposable

The onBeforeDeleteThreadComment event is fired before the thread comment is deleted.

Parameters

ParameterTypeDescription
callback(params, options) => false | voidCallback function that will be called when the event is fired

Returns

IDisposable

A disposable object that can be used to unsubscribe from the event

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:586 (opens in a new tab)


onBeforeUpdateDataValidationCriteria()

onBeforeUpdateDataValidationCriteria(callback): IDisposable

The onBeforeUpdateDataValidationCriteria event is fired before the data validation rule is updated.

Parameters

ParameterTypeDescription
callback(params, options) => false | voidCallback function that will be called when the event is fired

Returns

IDisposable

A disposable object that can be used to unsubscribe from the event

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:438 (opens in a new tab)


onBeforeUpdateDataValidationOptions()

onBeforeUpdateDataValidationOptions(callback): IDisposable

The onBeforeUpdateDataValidationOptions event is fired before the data validation rule is updated.

Parameters

ParameterTypeDescription
callback(params, options) => false | voidCallback function that will be called when the event is fired

Returns

IDisposable

A disposable object that can be used to unsubscribe from the event

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:478 (opens in a new tab)


onBeforeUpdateDataValidationRange()

onBeforeUpdateDataValidationRange(callback): IDisposable

The onBeforeUpdateDataValidationRange event is fired before the data validation rule is updated.

Parameters

ParameterTypeDescription
callback(params, options) => false | voidCallback function that will be called when the event is fired

Returns

IDisposable

A disposable object that can be used to unsubscribe from the event

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:458 (opens in a new tab)


onBeforeUpdateThreadComment()

onBeforeUpdateThreadComment(callback): IDisposable

The onBeforeUpdateThreadComment event is fired before the thread comment is updated.

Parameters

ParameterTypeDescription
callback(params, options) => false | voidCallback function that will be called when the event is fired

Returns

IDisposable

A disposable object that can be used to unsubscribe from the event

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:567 (opens in a new tab)


onCommandExecuted()

onCommandExecuted(callback): IDisposable

Register a callback that will be triggered when a command is invoked targeting the Univer sheet.

Parameters

ParameterTypeDescription
callbackCommandListenerthe callback.

Returns

IDisposable

A function to dispose the listening.

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:298 (opens in a new tab)


onDataValidationChange()

onDataValidationChange(callback): IDisposable

The onDataValidationChange event is fired when the data validation rule of this sheet is changed.

Parameters

ParameterTypeDescription
callback(ruleChange) => voidCallback function that will be called when the event is fired

Returns

IDisposable

A disposable object that can be used to unsubscribe from the event

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:401 (opens in a new tab)


onDataValidationStatusChange()

onDataValidationStatusChange(callback): IDisposable

The onDataValidationStatusChange event is fired when the data validation status of this sheet is changed.

Parameters

ParameterTypeDescription
callback(statusChange) => voidCallback function that will be called when the event is fired

Returns

IDisposable

A disposable object that can be used to unsubscribe from the event

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:410 (opens in a new tab)


onSelectionChange()

onSelectionChange(callback): IDisposable

Parameters

ParameterType
callback(selections) => void

Returns

IDisposable

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:308 (opens in a new tab)


onThreadCommentChange()

onThreadCommentChange(callback): IDisposable

The onThreadCommentChange event is fired when the thread comment of this sheet is changed.

Parameters

ParameterTypeDescription
callback(commentUpdate) => false | voidCallback function that will be called when the event is fired

Returns

IDisposable

A disposable object that can be used to unsubscribe from the event

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:539 (opens in a new tab)


openDialog()

openDialog(dialog): IDisposable

open a dialog

Parameters

ParameterTypeDescription
dialogIDialogPartMethodOptionsthe dialog options

Returns

IDisposable

the disposable object

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:266 (opens in a new tab)


openSiderbar()

openSiderbar(params): IDisposable

open a sidebar

Parameters

ParameterTypeDescription
paramsISidebarMethodOptionsthe sidebar options

Returns

IDisposable

the disposable object

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:256 (opens in a new tab)


parseSheetHyperlink()

parseSheetHyperlink(hyperlink): ISheetHyperLinkInfo

parse the hyperlink string to get the hyperlink info

Parameters

ParameterTypeDescription
hyperlinkstringthe hyperlink string

Returns

ISheetHyperLinkInfo

the hyperlink info

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:619 (opens in a new tab)


redo()

redo(): Promise<boolean>

Returns

Promise<boolean>

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:245 (opens in a new tab)


save()

save(): IWorkbookData

save workbook snapshot data, including conditional formatting, data validation, and other plugin data.

Returns

IWorkbookData

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:95 (opens in a new tab)


setActiveRange()

setActiveRange(range): void

Sets the active selection region for this sheet.

Parameters

ParameterTypeDescription
rangeFRangeThe range to set as the active selection.

Returns

void

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:355 (opens in a new tab)


setActiveSheet()

setActiveSheet(sheet): FWorksheet

Sets the given worksheet to be the active worksheet in the workbook.

Parameters

ParameterTypeDescription
sheetFWorksheetThe worksheet to set as the active worksheet.

Returns

FWorksheet

The active worksheet

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:193 (opens in a new tab)


setEditable()

setEditable(value): void

Used to modify the editing permissions of the workbook. When the value is false, editing is not allowed.

Parameters

ParameterTypeDescription
valuebooleaneditable value want to set

Returns

void

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:329 (opens in a new tab)


undo()

undo(): Promise<boolean>

Returns

Promise<boolean>

Defined in

submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:240 (opens in a new tab)


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