@univerjs/facade v0.4.2 • Docs
Class: FWorkbook
Constructors
new FWorkbook()
new FWorkbook(
_workbook,
_injector,
_resourceLoaderService,
_selectionManagerService,
_univerInstanceService,
_commandService,
_permissionService,
_logService): FWorkbook
Parameters
Parameter | Type |
---|---|
_workbook | Workbook |
_injector | Injector |
_resourceLoaderService | IResourceLoaderService |
_selectionManagerService | SheetsSelectionsService |
_univerInstanceService | IUniverInstanceService |
_commandService | ICommandService |
_permissionService | IPermissionService |
_logService | ILogService |
Returns
Defined in
submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:62 (opens in a new tab)
Properties
Property | Modifier | Type | Defined in |
---|---|---|---|
_injector | readonly | Injector | submodules/univer/packages/facade/src/apis/sheets/f-workbook.ts:64 (opens in a new tab) |
id | readonly | string | submodules/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
Parameter | Type | Description |
---|---|---|
name | string | Name of the new sheet |
rows | number | How may rows would the new sheet have |
column | number | How many columns would the new sheet have |
Returns
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
Parameter | Type | Description |
---|---|---|
sheetId | string | the sheet id to link |
range ? | string | IRange | the 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
Parameter | Type | Description |
---|---|---|
sheet | FWorksheet | The 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
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
Parameter | Type | Description |
---|---|---|
name | string | The 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
Parameter | Type | Description |
---|---|---|
sheetId | string | The 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
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}
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
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
Parameter | Type | Description |
---|---|---|
hyperlink | string | the 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
Parameter | Type | Description |
---|---|---|
callback | (params , options ) => false | void | Callback function that will be called when the event is fired |
Returns
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
Parameter | Type | Description |
---|---|---|
callback | (params , options ) => false | void | Callback function that will be called when the event is fired |
Returns
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
Parameter | Type | Description |
---|---|---|
callback | CommandListener | the callback. |
Returns
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
Parameter | Type | Description |
---|---|---|
callback | (params , options ) => false | void | Callback function that will be called when the event is fired |
Returns
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
Parameter | Type | Description |
---|---|---|
callback | (params , options ) => false | void | Callback function that will be called when the event is fired |
Returns
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
Parameter | Type | Description |
---|---|---|
callback | (params , options ) => false | void | Callback function that will be called when the event is fired |
Returns
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
Parameter | Type | Description |
---|---|---|
callback | (params , options ) => false | void | Callback function that will be called when the event is fired |
Returns
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
Parameter | Type | Description |
---|---|---|
callback | (params , options ) => false | void | Callback function that will be called when the event is fired |
Returns
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
Parameter | Type | Description |
---|---|---|
callback | (params , options ) => false | void | Callback function that will be called when the event is fired |
Returns
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
Parameter | Type | Description |
---|---|---|
callback | (params , options ) => false | void | Callback function that will be called when the event is fired |
Returns
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
Parameter | Type | Description |
---|---|---|
callback | CommandListener | the callback. |
Returns
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
Parameter | Type | Description |
---|---|---|
callback | (ruleChange ) => void | Callback function that will be called when the event is fired |
Returns
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
Parameter | Type | Description |
---|---|---|
callback | (statusChange ) => void | Callback function that will be called when the event is fired |
Returns
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
Parameter | Type |
---|---|
callback | (selections ) => void |
Returns
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
Parameter | Type | Description |
---|---|---|
callback | (commentUpdate ) => false | void | Callback function that will be called when the event is fired |
Returns
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
Parameter | Type | Description |
---|---|---|
dialog | IDialogPartMethodOptions | the dialog options |
Returns
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
Parameter | Type | Description |
---|---|---|
params | ISidebarMethodOptions | the sidebar options |
Returns
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
Parameter | Type | Description |
---|---|---|
hyperlink | string | the hyperlink string |
Returns
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
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
Parameter | Type | Description |
---|---|---|
range | FRange | The 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
Parameter | Type | Description |
---|---|---|
sheet | FWorksheet | The worksheet to set as the active worksheet. |
Returns
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
Parameter | Type | Description |
---|---|---|
value | boolean | editable 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)