@univerjs/core v0.5.0-beta.1 • Docs
Class: Workbook
Access and create Univer Sheets files
Extends
UnitModel
<IWorkbookData
,UniverInstanceType.UNIVER_SHEET
>
Constructors
new Workbook()
new Workbook(workbookData, _logService): Workbook
Parameters
Parameter | Type |
---|---|
workbookData | Partial <IWorkbookData > |
_logService | ILogService |
Returns
Overrides
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:84
Properties
Property | Modifier | Type | Default value | Overrides | Inherited from | Defined in |
---|---|---|---|---|---|---|
_disposed | protected | boolean | false | - | UnitModel ._disposed | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/lifecycle.ts:93 |
activeSheet$ | readonly | Observable <Nullable <Worksheet >> | undefined | - | - | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:48 |
name$ | readonly | Observable <string > | undefined | UnitModel .name$ | - | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:75 |
sheetCreated$ | readonly | Observable <Worksheet > | undefined | - | - | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:41 |
sheetDisposed$ | readonly | Observable <Worksheet > | undefined | - | - | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:44 |
type | public | UNIVER_SHEET | UniverInstanceType.UNIVER_SHEET | UnitModel .type | - | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:38 |
Accessors
name
Get Signature
get name(): string
Returns
string
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:76
Methods
addWorksheet()
addWorksheet(
id,
index,
worksheetSnapshot): boolean
Add a Worksheet into Workbook.
Parameters
Parameter | Type |
---|---|
id | string |
index | number |
worksheetSnapshot | Partial <IWorksheetData > |
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:170
checkSheetName()
checkSheetName(name): boolean
Check if sheet name is unique
Parameters
Parameter | Type | Description |
---|---|---|
name | string | sheet name |
Returns
boolean
True if sheet name is unique
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:358
dispose()
dispose(): void
Returns
void
Overrides
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:113
disposeWithMe()
disposeWithMe(disposable): IDisposable
Parameters
Parameter | Type |
---|---|
disposable | DisposableLike |
Returns
Inherited from
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/lifecycle.ts:96
ensureActiveSheet()
ensureActiveSheet(): Worksheet
If there is no active sheet, the first sheet would be set active.
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:228
ensureNotDisposed()
protected ensureNotDisposed(): void
Returns
void
Inherited from
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/lifecycle.ts:100
generateNewSheetName()
generateNewSheetName(name): string
Automatically generate new sheet name
Parameters
Parameter | Type | Description |
---|---|---|
name | string | sheet name |
Returns
string
New sheet name
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:382
getActiveSheet()
getActiveSheet(undefined)
getActiveSheet(): Worksheet
Get the active sheet.
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:213
getActiveSheet(allowNull)
getActiveSheet(allowNull): Nullable<Worksheet>
Parameters
Parameter | Type |
---|---|
allowNull | true |
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:214
getActiveSheetIndex()
getActiveSheetIndex(): number
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:274
getActiveSpreadsheet()
getActiveSpreadsheet(): Workbook
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:193
getConfig()
getConfig(): IWorkbookData
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:201
getHiddenWorksheets()
getHiddenWorksheets(): string[]
Returns
string
[]
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:336
getIndexBySheetId()
getIndexBySheetId(sheetId): number
Parameters
Parameter | Type |
---|---|
sheetId | string |
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:205
getName()
getName(): string
Returns
string
Deprecated
use use name property instead
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:142
getRev()
getRev(): number
Get revision of the unit’s snapshot. Note that revision should start from 1.
Returns
number
Overrides
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:155
getSheetByIndex()
getSheetByIndex(index): Nullable<Worksheet>
Parameters
Parameter | Type |
---|---|
index | number |
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:331
getSheetBySheetId()
getSheetBySheetId(sheetId): Nullable<Worksheet>
Parameters
Parameter | Type |
---|---|
sheetId | string |
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:327
getSheetBySheetName()
getSheetBySheetName(name): Nullable<Worksheet>
Parameters
Parameter | Type |
---|---|
name | string |
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:318
getSheetIndex()
getSheetIndex(sheet): number
Parameters
Parameter | Type |
---|---|
sheet | Worksheet |
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:307
getSheetOrders()
getSheetOrders(): readonly string[]
Returns
readonly string
[]
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:185
getSheets()
getSheets(): Worksheet[]
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:286
getSheetSize()
getSheetSize(): number
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:282
getSheetsName()
getSheetsName(): string[]
Returns
string
[]
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:292
getSnapshot()
getSnapshot(): IWorkbookData
Get current snapshot reference. Call resourceLoaderService.saveWorkbook to save the data associated with the current plugin if needed.
Returns
{IWorkbookData}
Memberof
Workbook
Overrides
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:137
getStyles()
getStyles(): Styles
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:197
getUnhiddenWorksheets()
getUnhiddenWorksheets(): string[]
Returns
string
[]
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:342
getUnitId()
getUnitId(): string
Returns
string
Overrides
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:151
getWorksheets()
getWorksheets(): Map<string, Worksheet>
Returns
Map
<string
, Worksheet
>
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:189
incrementRev()
incrementRev(): void
Increment the current revision.
Returns
void
Overrides
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:159
load()
load(config): void
Parameters
Parameter | Type |
---|---|
config | IWorkbookData |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:348
removeSheet()
removeSheet(sheetId): boolean
Parameters
Parameter | Type |
---|---|
sheetId | string |
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:260
save()
save(): IWorkbookData
Create a clone of the current snapshot. Call resourceLoaderService.saveWorkbook to save the data associated with the current plugin if needed.
Returns
Memberof
Workbook
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:127
setActiveSheet()
setActiveSheet(worksheet): void
ActiveSheet should not be null! There is at least one sheet in a workbook. You can not delete all sheets in a workbook.
Parameters
Parameter | Type |
---|---|
worksheet | Worksheet |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:256
setName()
setName(name): void
Parameters
Parameter | Type |
---|---|
name | string |
Returns
void
Overrides
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:146
setRev()
setRev(rev): void
Set revision of the current snapshot.
Parameters
Parameter | Type |
---|---|
rev | number |
Returns
void
Overrides
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:163
uniqueSheetName()
uniqueSheetName(name): string
Check whether the sheet name is unique and generate a new unique sheet name
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
name | string | 'Sheet1' | sheet name |
Returns
string
Unique sheet name
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:368
isIRangeType()
static isIRangeType(range): boolean
Parameters
Parameter | Type |
---|---|
range | IRangeType | IRangeType [] |
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/workbook.ts:80