@univerjssheets-zen-editorfacadeclassesFworkbooksheetszeneditormixin

@univerjs/sheets-zen-editor v0.5.4


Class: FWorkbookSheetsZenEditorMixin

Defined in: sheets-zen-editor/src/facade/f-workbook.ts:45

Extends

Implements

Constructors

new FWorkbookSheetsZenEditorMixin()

new FWorkbookSheetsZenEditorMixin(
   _workbook, 
   _injector, 
   _resourceLoaderService, 
   _selectionManagerService, 
   _univerInstanceService, 
   _commandService, 
   _permissionService, 
   _logService, 
   _localeService, 
   _definedNamesService): FWorkbookSheetsZenEditorMixin

Defined in: sheets/src/facade/f-workbook.ts:32

Parameters

ParameterType
_workbookWorkbook
_injectorInjector
_resourceLoaderServiceIResourceLoaderService
_selectionManagerServiceSheetsSelectionsService
_univerInstanceServiceIUniverInstanceService
_commandServiceICommandService
_permissionServiceIPermissionService
_logServiceILogService
_localeServiceLocaleService
_definedNamesServiceIDefinedNamesService

Returns

FWorkbookSheetsZenEditorMixin

Inherited from

FWorkbook.constructor

Properties

PropertyModifierTypeDefault valueInherited fromDefined in
_commandServicereadonlyICommandServiceundefinedFWorkbook._commandServicesheets/src/facade/f-workbook.ts:38
_definedNamesServicereadonlyIDefinedNamesServiceundefinedFWorkbook._definedNamesServicesheets/src/facade/f-workbook.ts:42
_disposedprotectedbooleanfalseFWorkbook._disposedcore/src/shared/lifecycle.ts:96
_injectorreadonlyInjectorundefinedFWorkbook._injectorsheets/src/facade/f-workbook.ts:34
_localeServicereadonlyLocaleServiceundefinedFWorkbook._localeServicesheets/src/facade/f-workbook.ts:41
_logServicereadonlyILogServiceundefinedFWorkbook._logServicesheets/src/facade/f-workbook.ts:40
_permissionServicereadonlyIPermissionServiceundefinedFWorkbook._permissionServicesheets/src/facade/f-workbook.ts:39
_resourceLoaderServicereadonlyIResourceLoaderServiceundefinedFWorkbook._resourceLoaderServicesheets/src/facade/f-workbook.ts:35
_selectionManagerServicereadonlySheetsSelectionsServiceundefinedFWorkbook._selectionManagerServicesheets/src/facade/f-workbook.ts:36
_univerInstanceServicereadonlyIUniverInstanceServiceundefinedFWorkbook._univerInstanceServicesheets/src/facade/f-workbook.ts:37
_workbookreadonlyWorkbookundefinedFWorkbook._workbooksheets/src/facade/f-workbook.ts:33
idreadonlystringundefinedFWorkbook.idsheets/src/facade/f-workbook.ts:30

Accessors

Enum

Get Signature

get Enum(): FEnum

Defined in: sheets/src/facade/f-workbook.ts:104

Returns

FEnum

Inherited from

FWorkbook.Enum


Event

Get Signature

get Event(): FEventName

Defined in: sheets/src/facade/f-workbook.ts:111

Returns

FEventName

The event name.

Inherited from

FWorkbook.Event

Methods

_initialize()

_initialize(injector): void

Defined in: core/src/facade/f-base.ts:66

Parameters

ParameterType
injectorInjector

Returns

void

Inherited from

FWorkbook._initialize


addEvent()

addEvent(event, callback): IDisposable

Defined in: sheets/src/facade/f-workbook.ts:75

Add an event listener

Parameters

ParameterTypeDescription
eventkeyof IEventParamConfigkey of event
callback(params) => voidcallback when event triggered

Returns

IDisposable

The Disposable instance, for remove the listener

Example

univerAPI.addEvent(univerAPI.event.UnitCreated, (params) => {
    console.log('unit created', params);
});

Inherited from

FWorkbook.addEvent


addUIEvent()

addUIEvent(event, _callback): void

Defined in: sheets/src/facade/f-workbook.ts:100

Parameters

ParameterType
eventkeyof IEventParamConfig
_callback(params) => void

Returns

void

Inherited from

FWorkbook.addUIEvent


create()

create(
   name, 
   rows, 
   column): FWorksheet

Defined in: sheets/src/facade/f-workbook.ts:226

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

Example

// The code below creates a new sheet
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const newSheet = activeSpreadsheet.create('MyNewSheet', 10, 10);

Inherited from

FWorkbook.create


deleteActiveSheet()

deleteActiveSheet(): boolean

Defined in: sheets/src/facade/f-workbook.ts:564

Deletes the currently active sheet.

Returns

boolean

true if the sheet was deleted, false otherwise

Example

// The code below deletes the currently active sheet and stores the new active
// sheet in a variable
const sheet = univerAPI.getActiveWorkbook().deleteActiveSheet();

Inherited from

FWorkbook.deleteActiveSheet


deleteDefinedName()

deleteDefinedName(name): boolean

Defined in: sheets/src/facade/f-workbook.ts:794

Delete the defined name with the given name.

Parameters

ParameterTypeDescription
namestringThe name of the defined name to delete

Returns

boolean

true if the defined name was deleted, false otherwise

Example

// The code below deletes the defined name with the given name
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const deleted = activeSpreadsheet.deleteDefinedName('MyDefinedName');

Inherited from

FWorkbook.deleteDefinedName


deleteSheet()

deleteSheet(sheet): boolean

Defined in: sheets/src/facade/f-workbook.ts:363

Deletes the specified worksheet.

Parameters

ParameterTypeDescription
sheetFWorksheetThe worksheet to delete.

Returns

boolean

True if the worksheet was deleted, false otherwise.

Example

// The code below deletes the specified worksheet
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const sheet = activeSpreadsheet.getSheetByName('Sheet1');
activeSpreadsheet.deleteSheet(sheet);

Inherited from

FWorkbook.deleteSheet


disableSelection()

disableSelection(): FWorkbook

Defined in: sheets-ui/src/facade/f-workbook.ts:127

Disable selection. After disabled, there would be no response for selection.

Returns

FWorkbook

FWorkbook instance

Example

univerAPI.getActiveWorkbook().disableSelection();

Inherited from

FWorkbook.disableSelection

dispose()

dispose(): void

Defined in: core/src/shared/lifecycle.ts:109

Returns

void

Inherited from

FWorkbook.dispose


disposeWithMe()

disposeWithMe(disposable): IDisposable

Defined in: core/src/shared/lifecycle.ts:99

Parameters

ParameterType
disposableDisposableLike

Returns

IDisposable

Inherited from

FWorkbook.disposeWithMe


duplicateActiveSheet()

duplicateActiveSheet(): FWorksheet

Defined in: sheets/src/facade/f-workbook.ts:600

Duplicates the active sheet.

Returns

FWorksheet

The duplicated worksheet

Example

// The code below duplicates the active sheet
 const activeSpreadsheet = univerAPI.getActiveWorkbook();
 activeSpreadsheet.duplicateActiveSheet();

Inherited from

FWorkbook.duplicateActiveSheet


duplicateSheet()

duplicateSheet(sheet): FWorksheet

Defined in: sheets/src/facade/f-workbook.ts:581

Duplicates the given worksheet.

Parameters

ParameterTypeDescription
sheetFWorksheetThe worksheet to duplicate.

Returns

FWorksheet

The duplicated worksheet

Example

// The code below duplicates the given worksheet
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();
activeSpreadsheet.duplicateSheet(activeSheet);

Inherited from

FWorkbook.duplicateSheet


enableSelection()

enableSelection(): FWorkbook

Defined in: sheets-ui/src/facade/f-workbook.ts:136

Enable selection. After this you can select range.

Returns

FWorkbook

Example

univerAPI.getActiveWorkbook().enableSelection();

Inherited from

FWorkbook.enableSelection

endEditing()

endEditing(save?): Promise<boolean>

Defined in: sheets-ui/src/facade/f-workbook.ts:101

Use endEditingAsync as instead

Parameters

ParameterTypeDescription
save?booleanWhether to save the changes

Returns

Promise<boolean>

A promise that resolves to a boolean value

Deprecated

End the editing process

Async

Example

univerAPI.getActiveWorkbook().endEditing(true);

Inherited from

FWorkbook.endEditing

endEditingAsync()

endEditingAsync(save?): Promise<boolean>

Defined in: sheets-ui/src/facade/f-workbook.ts:108

Parameters

ParameterTypeDescription
save?booleanWhether to save the changes, default is true

Returns

Promise<boolean>

A promise that resolves to a boolean value

Async

Inherited from

FWorkbook.endEditingAsync

endZenEditingAsync()

endZenEditingAsync(save): Promise<boolean>

Defined in: sheets-zen-editor/src/facade/f-workbook.ts:52

End the zen editing process

Parameters

ParameterTypeDefault valueDescription
savebooleantrueWhether to save the changes, default is true

Returns

Promise<boolean>

A promise that resolves to a boolean indicating whether the zen editing process was ended successfully.

Async

Example

univerAPI.getActiveWorkbook().endZenEditingAsync(false);

Implementation of

IFWorkbookSheetsZenEditorMixin.endZenEditingAsync

Overrides

FWorkbook.endZenEditingAsync

ensureNotDisposed()

protected ensureNotDisposed(): void

Defined in: core/src/shared/lifecycle.ts:103

Returns

void

Inherited from

FWorkbook.ensureNotDisposed


fireEvent()

protected fireEvent<T>(event, params): undefined | boolean

Defined in: sheets/src/facade/f-workbook.ts:92

Fire an event, used in internal only.

Type Parameters

Type Parameter
T extends keyof IEventParamConfig

Parameters

ParameterTypeDescription
eventT{string} key of event
paramsIEventParamConfig[T]{any} params of event

Returns

undefined | boolean

should cancel

Example

this.fireEvent(univerAPI.event.UnitCreated, params);

Inherited from

FWorkbook.fireEvent


getActiveRange()

getActiveRange(): null | FRange

Defined in: sheets/src/facade/f-workbook.ts:543

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

Returns

null | FRange

the active range

Inherited from

FWorkbook.getActiveRange


getActiveSheet()

getActiveSheet(): FWorksheet

Defined in: sheets/src/facade/f-workbook.ts:192

Get the active sheet of the workbook.

Returns

FWorksheet

The active sheet of the workbook

Example

// The code below gets the active sheet of the workbook
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const activeSheet = activeSpreadsheet.getActiveSheet();

Inherited from

FWorkbook.getActiveSheet


getCustomMetadata()

getCustomMetadata(): CustomData

Defined in: sheets/src/facade/f-workbook.ts:915

Get custom metadata of workbook

Returns

CustomData

custom metadata

Example

const fWorkbook = univerAPI.getActiveWorkbook();
const custom = fWorkbook.getCustomMetadata();

Inherited from

FWorkbook.getCustomMetadata


getDefinedName()

getDefinedName(name): null | FDefinedName

Defined in: sheets/src/facade/f-workbook.ts:734

Get the defined name by name.

Parameters

ParameterTypeDescription
namestringThe name of the defined name to get

Returns

null | FDefinedName

The defined name with the given name

Example

// The code below gets the defined name by name
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const definedName = activeSpreadsheet.getDefinedName('MyDefinedName');

Inherited from

FWorkbook.getDefinedName


getDefinedNames()

getDefinedNames(): FDefinedName[]

Defined in: sheets/src/facade/f-workbook.ts:753

Get all the defined names in the workbook.

Returns

FDefinedName[]

All the defined names in the workbook

Example

// The code below gets all the defined names in the workbook
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const definedNames = activeSpreadsheet.getDefinedNames();

Inherited from

FWorkbook.getDefinedNames


getId()

getId(): string

Defined in: sheets/src/facade/f-workbook.ts:125

Get the id of the workbook.

Returns

string

The id of the workbook.

Example

// The code below gets the id of the workbook
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const id = activeSpreadsheet.getId();

Inherited from

FWorkbook.getId


getLocale()

getLocale(): LocaleType

Defined in: sheets/src/facade/f-workbook.ts:629

Get the locale of the workbook.

Returns

LocaleType

The locale of the workbook

Example

// The code below gets the locale of the workbook
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const locale = activeSpreadsheet.getLocale();

Inherited from

FWorkbook.getLocale


getName()

getName(): string

Defined in: sheets/src/facade/f-workbook.ts:139

Get the name of the workbook.

Returns

string

The name of the workbook.

Example

// The code below gets the name of the workbook
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const name = activeSpreadsheet.getName();

Inherited from

FWorkbook.getName


getNumSheets()

getNumSheets(): number

Defined in: sheets/src/facade/f-workbook.ts:615

Get the number of sheets in the workbook.

Returns

number

The number of sheets in the workbook

Example

// The code below gets the number of sheets in the workbook
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const numSheets = activeSpreadsheet.getNumSheets();

Inherited from

FWorkbook.getNumSheets


getPermission()

getPermission(): FPermission

Defined in: sheets/src/facade/f-workbook.ts:719

Get the PermissionInstance.

Returns

FPermission

  • The PermissionInstance.

Inherited from

FWorkbook.getPermission


getRegisteredRangeThemes()

getRegisteredRangeThemes(): string[]

Defined in: sheets/src/facade/f-workbook.ts:848

Gets the registered range themes.

Returns

string[]

The name list of registered range themes.

Example

// The code below gets the registered range themes
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const themes = activeSpreadsheet.getRegisteredRangeThemes();
console.log(themes);

Inherited from

FWorkbook.getRegisteredRangeThemes


getScrollStateBySheetId()

getScrollStateBySheetId(sheetId): Nullable<IScrollState>

Defined in: sheets-ui/src/facade/f-workbook.ts:117

Parameters

ParameterType
sheetIdstring

Returns

Nullable<IScrollState>

Inherited from

FWorkbook.getScrollStateBySheetId

getSheetByName()

getSheetByName(name): null | FWorksheet

Defined in: sheets/src/facade/f-workbook.ts:283

Get a worksheet by sheet name.

Parameters

ParameterTypeDescription
namestringThe name of the sheet to get.

Returns

null | FWorksheet

The worksheet with given sheet name

Example

// The code below gets a worksheet by sheet name
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const sheet = activeSpreadsheet.getSheetByName('Sheet1');

Inherited from

FWorkbook.getSheetByName


getSheetBySheetId()

getSheetBySheetId(sheetId): null | FWorksheet

Defined in: sheets/src/facade/f-workbook.ts:263

Get a worksheet by sheet id.

Parameters

ParameterTypeDescription
sheetIdstringThe id of the sheet to get.

Returns

null | FWorksheet

The worksheet with given sheet id

Example

// The code below gets a worksheet by sheet id
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const sheet = activeSpreadsheet.getSheetBySheetId('sheetId');

Inherited from

FWorkbook.getSheetBySheetId


getSheets()

getSheets(): FWorksheet[]

Defined in: sheets/src/facade/f-workbook.ts:207

Gets all the worksheets in this workbook

Returns

FWorksheet[]

An array of all the worksheets in the workbook

Example

// The code below gets all the worksheets in the workbook
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const sheets = activeSpreadsheet.getSheets();

Inherited from

FWorkbook.getSheets


getSnapshot()

getSnapshot(): IWorkbookData

Defined in: sheets/src/facade/f-workbook.ts:177

Returns

IWorkbookData

{IWorkbookData} Workbook snapshot data

Deprecated

use ‘save’ instead.

Memberof

FWorkbook

Inherited from

FWorkbook.getSnapshot


getUrl()

getUrl(): string

Defined in: sheets/src/facade/f-workbook.ts:667

Get the URL of the workbook.

Returns

string

The URL of the workbook

Example

// The code below gets the URL of the workbook
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const url = activeSpreadsheet.getUrl();

Inherited from

FWorkbook.getUrl


getWorkbook()

getWorkbook(): Workbook

Defined in: sheets/src/facade/f-workbook.ts:49

Returns

Workbook

Inherited from

FWorkbook.getWorkbook


insertDefinedName()

insertDefinedName(name, formulaOrRefString): FWorkbook

Defined in: sheets/src/facade/f-workbook.ts:775

Insert a defined name.

Parameters

ParameterTypeDescription
namestringThe name of the defined name to insert
formulaOrRefStringstringThe formula(=sum(A2:b10)) or reference(A1) string of the defined name to insert

Returns

FWorkbook

The current FWorkbook instance

Example

// The code below inserts a defined name
const activeSpreadsheet = univerAPI.getActiveWorkbook();
activeSpreadsheet.insertDefinedName('MyDefinedName', 'Sheet1!A1');

Inherited from

FWorkbook.insertDefinedName


insertDefinedNameBuilder()

insertDefinedNameBuilder(param): void

Defined in: sheets/src/facade/f-workbook.ts:816

Insert a defined name by builder param.

Parameters

ParameterTypeDescription
paramISetDefinedNameMutationParamThe param to insert the defined name

Returns

void

Example

// The code below inserts a defined name by builder param
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const builder = univerAPI.newDefinedName();
const param = builder.setName('MyDefinedName').setRef('Sheet1!A1').build();
activeSpreadsheet.insertDefinedNameBuilder(param);

Inherited from

FWorkbook.insertDefinedNameBuilder


insertSheet()

insertSheet(sheetName?): FWorksheet

Defined in: sheets/src/facade/f-workbook.ts:329

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

Parameters

ParameterTypeDescription
sheetName?string(optional) The name of the new sheet

Returns

FWorksheet

The new sheet

Example

// The code below inserts a new sheet into the workbook
const activeSpreadsheet = univerAPI.getActiveWorkbook();
activeSpreadsheet.insertSheet();
 
// The code below inserts a new sheet into the workbook, using a custom name
const activeSpreadsheet = univerAPI.getActiveWorkbook();
activeSpreadsheet.insertSheet('MyNewSheet');

Inherited from

FWorkbook.insertSheet


moveActiveSheet()

moveActiveSheet(index): FWorkbook

Defined in: sheets/src/facade/f-workbook.ts:710

Move the active sheet to the specified index.

Parameters

ParameterTypeDescription
indexnumberThe index to move the active sheet to

Returns

FWorkbook

This workbook, for chaining

Example

// The code below moves the active sheet to the specified index
const activeSpreadsheet = univerAPI.getActiveWorkbook();
activeSpreadsheet.moveActiveSheet(1);

Inherited from

FWorkbook.moveActiveSheet


moveSheet()

moveSheet(sheet, index): FWorkbook

Defined in: sheets/src/facade/f-workbook.ts:684

Move the sheet to the specified index.

Parameters

ParameterTypeDescription
sheetFWorksheetThe sheet to move
indexnumberThe index to move the sheet to

Returns

FWorkbook

This workbook, for chaining

Example

// The code below moves the sheet to the specified index
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const sheet = activeSpreadsheet.getActiveSheet();
activeSpreadsheet.moveSheet(sheet, 1);

Inherited from

FWorkbook.moveSheet


onBeforeCommandExecute()

onBeforeCommandExecute(callback): IDisposable

Defined in: sheets/src/facade/f-workbook.ts:424

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.

Example

// The code below registers a callback that will be triggered before invoking a command targeting the Univer sheet
const activeSpreadsheet = univerAPI.getActiveWorkbook();
activeSpreadsheet.onBeforeCommandExecute((command) => {
   console.log('Command executed:', command);
});

Inherited from

FWorkbook.onBeforeCommandExecute


onCellClick()

onCellClick(callback): IDisposable

Defined in: sheets-ui/src/facade/f-workbook.ts:50

Subscribe to cell click events

Parameters

ParameterTypeDescription
callback(cell) => voidThe callback function to be called when a cell is clicked

Returns

IDisposable

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

Inherited from

FWorkbook.onCellClick

onCellHover()

onCellHover(callback): IDisposable

Defined in: sheets-ui/src/facade/f-workbook.ts:57

Subscribe cell hover events

Parameters

ParameterTypeDescription
callback(cell) => voidThe callback function to be called when a cell is hovered

Returns

IDisposable

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

Inherited from

FWorkbook.onCellHover

onCellPointerDown()

onCellPointerDown(callback): IDisposable

Defined in: sheets-ui/src/facade/f-workbook.ts:68

Subscribe to cell pointer down events.

Parameters

ParameterTypeDescription
callback(cell) => voidThe callback function accept cell location and event.

Returns

IDisposable

Inherited from

FWorkbook.onCellPointerDown

onCellPointerMove()

onCellPointerMove(callback): IDisposable

Defined in: sheets-ui/src/facade/f-workbook.ts:63

Subscribe to pointer move events on workbook. Just like onCellHover, but with event information.

Parameters

ParameterTypeDescription
callback(cell, event) => voidThe callback function accept cell location and event.

Returns

IDisposable

Inherited from

FWorkbook.onCellPointerMove

onCellPointerUp()

onCellPointerUp(callback): IDisposable

Defined in: sheets-ui/src/facade/f-workbook.ts:73

Subscribe to cell pointer up events.

Parameters

ParameterTypeDescription
callback(cell) => voidThe callback function accept cell location and event.

Returns

IDisposable

Inherited from

FWorkbook.onCellPointerUp

onCommandExecuted()

onCommandExecuted(callback): IDisposable

Defined in: sheets/src/facade/f-workbook.ts:452

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.

Example

// The code below registers a callback that will be triggered when a command is invoked targeting the Univer sheet
const activeSpreadsheet = univerAPI.getActiveWorkbook();
activeSpreadsheet.onCommandExecuted((command) => {
  console.log('Command executed:', command);
});
 
#### Inherited from
 
[`FWorkbook`](../../../sheets/facade/classes/FWorkbook.md).[`onCommandExecuted`](../../../sheets/facade/classes/FWorkbook.md#oncommandexecuted)
 
***
 
### onDragOver()
 
```ts
onDragOver(callback): IDisposable

Defined in: sheets-ui/src/facade/f-workbook.ts:75

Parameters

ParameterType
callback(cell) => void

Returns

IDisposable

Inherited from

FWorkbook.onDragOver

onDrop()

onDrop(callback): IDisposable

Defined in: sheets-ui/src/facade/f-workbook.ts:77

Parameters

ParameterType
callback(cell) => void

Returns

IDisposable

Inherited from

FWorkbook.onDrop

onSelectionChange()

onSelectionChange(callback): IDisposable

Defined in: sheets/src/facade/f-workbook.ts:473

Register a callback that will be triggered when the selection changes.

Parameters

ParameterTypeDescription
callback(selections) => voidThe callback.

Returns

IDisposable

A function to dispose the listening

Inherited from

FWorkbook.onSelectionChange


openDialog()

openDialog(dialog): IDisposable

Defined in: sheets-ui/src/facade/f-workbook.ts:43

Open a dialog.

Parameters

ParameterTypeDescription
dialogIDialogPartMethodOptionsthe dialog options

Returns

IDisposable

the disposable object

Deprecated

Inherited from

FWorkbook.openDialog

openSiderbar()

openSiderbar(params): IDisposable

Defined in: sheets-ui/src/facade/f-workbook.ts:35

Open a sidebar.

Parameters

ParameterTypeDescription
paramsISidebarMethodOptionsthe sidebar options

Returns

IDisposable

the disposable object

Deprecated

Inherited from

FWorkbook.openSiderbar

redo()

redo(): FWorkbook

Defined in: sheets/src/facade/f-workbook.ts:399

Redo the last undone action.

Returns

FWorkbook

A promise that resolves to true if the redo was successful, false otherwise.

Example

// The code below redoes the last undone action
const activeSpreadsheet = univerAPI.getActiveWorkbook();
activeSpreadsheet.redo();

Inherited from

FWorkbook.redo


registerRangeTheme()

registerRangeTheme(rangeThemeStyle): void

Defined in: sheets/src/facade/f-workbook.ts:868

Register a custom range theme style.

Parameters

ParameterType
rangeThemeStyleRangeThemeStyle

Returns

void

Example

// import {RangeThemeStyle} from '@univerjs/sheets';
const fWorkbook = univerAPI.getActiveWorkbook();
const rangeThemeStyle = new RangeThemeStyle('MyTheme');
rangeThemeStyle.setSecondRowStyle({
   bg: {
      rgb: 'rgb(214,231,241)',
   },
});
fWorkbook.registerRangeTheme(rangeThemeStyle);

Inherited from

FWorkbook.registerRangeTheme


save()

save(): IWorkbookData

Defined in: sheets/src/facade/f-workbook.ts:167

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

Returns

IWorkbookData

Workbook snapshot data

Example

// The code below saves the workbook snapshot data
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const snapshot = activeSpreadsheet.save();

Inherited from

FWorkbook.save


setActiveRange()

setActiveRange(range): FWorkbook

Defined in: sheets/src/facade/f-workbook.ts:511

Sets the selection region for active sheet.

Parameters

ParameterTypeDescription
rangeFRangeThe range to set as the active selection.

Returns

FWorkbook

FWorkbook instance

Inherited from

FWorkbook.setActiveRange


setActiveSheet()

setActiveSheet(sheet): FWorksheet

Defined in: sheets/src/facade/f-workbook.ts:304

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

Example

// The code below sets the given worksheet to be the active worksheet
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const sheet = activeSpreadsheet.getSheetByName('Sheet1');
activeSpreadsheet.setActiveSheet(sheet);

Inherited from

FWorkbook.setActiveSheet


setCustomMetadata()

setCustomMetadata(custom): FWorkbook

Defined in: sheets/src/facade/f-workbook.ts:901

Set custom metadata of workbook

Parameters

ParameterTypeDescription
customCustomDatacustom metadata

Returns

FWorkbook

FWorkbook

Example

const fWorkbook = univerAPI.getActiveWorkbook();
fWorkbook.setCustomMetadata({ key: 'value' });

Inherited from

FWorkbook.setCustomMetadata


setEditable()

setEditable(value): FWorkbook

Defined in: sheets/src/facade/f-workbook.ts:495

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

FWorkbook

FWorkbook instance

Inherited from

FWorkbook.setEditable


setLocale()

setLocale(locale): void

Defined in: sheets/src/facade/f-workbook.ts:637

Parameters

ParameterTypeDescription
localeLocaleTypeThe locale to set

Returns

void

Deprecated

use setSpreadsheetLocale instead.

Inherited from

FWorkbook.setLocale


setName()

setName(name): void

Defined in: sheets/src/facade/f-workbook.ts:153

Set the name of the workbook.

Parameters

ParameterTypeDescription
namestringThe new name of the workbook.

Returns

void

Example

// The code below sets the name of the workbook
const activeSpreadsheet = univerAPI.getActiveWorkbook();
activeSpreadsheet.setName('MyWorkbook');

Inherited from

FWorkbook.setName


setSpreadsheetLocale()

setSpreadsheetLocale(locale): FWorkbook

Defined in: sheets/src/facade/f-workbook.ts:652

Set the locale of the workbook.

Parameters

ParameterTypeDescription
localeLocaleTypeThe locale to set

Returns

FWorkbook

This workbook, for chaining

Example

// The code below sets the locale of the workbook
const activeSpreadsheet = univerAPI.getActiveWorkbook();
activeSpreadsheet.setLocale(LocaleType.EN_US);

Inherited from

FWorkbook.setSpreadsheetLocale


showSelection()

showSelection(): FWorkbook

Defined in: sheets-ui/src/facade/f-workbook.ts:154

Set selection visible.

Returns

FWorkbook

Example

univerAPI.getActiveWorkbook().showSelection();

Inherited from

FWorkbook.showSelection

startEditing()

startEditing(): boolean

Defined in: sheets-ui/src/facade/f-workbook.ts:87

Start the editing process

Returns

boolean

A boolean value

Example

univerAPI.getActiveWorkbook().startEditing();

Inherited from

FWorkbook.startEditing

startZenEditingAsync()

startZenEditingAsync(): Promise<boolean>

Defined in: sheets-zen-editor/src/facade/f-workbook.ts:46

Start the zen editing process

Returns

Promise<boolean>

A promise that resolves to a boolean indicating whether the zen editing process was started successfully.

Example

univerAPI.getActiveWorkbook().startZenEditingAsync();

Implementation of

IFWorkbookSheetsZenEditorMixin.startZenEditingAsync

Overrides

FWorkbook.startZenEditingAsync

transparentSelection()

transparentSelection(): FWorkbook

Defined in: sheets-ui/src/facade/f-workbook.ts:145

Set selection invisible, Unlike disableSelection, selection still works, you just can not see them.

Returns

FWorkbook

Example

univerAPI.getActiveWorkbook().transparentSelection();

Inherited from

FWorkbook.transparentSelection

undo()

undo(): FWorkbook

Defined in: sheets/src/facade/f-workbook.ts:383

Undo the last action.

Returns

FWorkbook

A promise that resolves to true if the undo was successful, false otherwise.

Example

// The code below undoes the last action
const activeSpreadsheet = univerAPI.getActiveWorkbook();
activeSpreadsheet.undo();

Inherited from

FWorkbook.undo


unregisterRangeTheme()

unregisterRangeTheme(themeName): void

Defined in: sheets/src/facade/f-workbook.ts:884

Unregister a custom range theme style.

Parameters

ParameterType
themeNamestring

Returns

void

Example

const fWorkbook = univerAPI.getActiveWorkbook();
fWorkbook.unregisterRangeTheme('MyTheme');

Inherited from

FWorkbook.unregisterRangeTheme


updateDefinedNameBuilder()

updateDefinedNameBuilder(param): void

Defined in: sheets/src/facade/f-workbook.ts:833

Update the defined name with the given name.

Parameters

ParameterTypeDescription
paramISetDefinedNameMutationParamThe param to insert the defined name

Returns

void

Example

// The code below updates the defined name with the given name
const activeSpreadsheet = univerAPI.getActiveWorkbook();
const builder = activeSpreadsheet.getDefinedName('MyDefinedName').toBuilder();
builder.setRef('Sheet1!A2').setName('MyDefinedName1').build();
activeSpreadsheet.updateDefinedNameBuilder(param);

Inherited from

FWorkbook.updateDefinedNameBuilder


extend()

static extend(source): void

Defined in: core/src/facade/f-base.ts:68

Parameters

ParameterType
sourceany

Returns

void

Inherited from

FWorkbook.extend