@univerjs/core v0.5.0-beta.1 • Docs
Class: Worksheet
The model of a Worksheet.
Constructors
new Worksheet()
new Worksheet(
unitId,
snapshot,
_styles): Worksheet
Parameters
Parameter | Type |
---|---|
unitId | string |
snapshot | Partial <IWorksheetData > |
_styles | Styles |
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:81
Properties
Property | Modifier | Type | Defined in |
---|---|---|---|
_cellData | protected | ObjectMatrix <ICellData > | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:72 |
_columnManager | protected | ColumnManager | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:75 |
_rowManager | protected | RowManager | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:74 |
_sheetId | protected | string | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:70 |
_snapshot | protected | IWorksheetData | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:71 |
_spanModel | protected | SpanModel | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:79 |
_viewModel | readonly | SheetViewModel | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:77 |
unitId | readonly | string | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:82 |
Methods
__interceptViewModel()
__interceptViewModel(callback): void
Internal
Parameters
Parameter | Type |
---|---|
callback | (viewModel ) => void |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:103
cellHasValue()
cellHasValue(value): boolean
Parameters
Parameter | Type |
---|---|
value | ICellData |
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:809
clone()
clone(): Worksheet
Returns WorkSheet Clone Object
Returns
WorkSheet Clone Object
Deprecated
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:353
getBlankCellDocumentModel()
getBlankCellDocumentModel(cell): IDocumentLayoutObject
Only used for cell edit, and no need to rotate text when edit cell content!
Parameters
Parameter | Type |
---|---|
cell | Nullable <ICellData > |
Returns
IDocumentLayoutObject
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:1111
getCell()
getCell(row, col): Nullable<ICellDataForSheetInterceptor>
Get cellData, includes cellData, customRender, markers, dataValidate, etc.
WARNING: All sheet CELL_CONTENT interceptors will be called in this method, cause performance issue. example: this._sheetInterceptorService.intercept(INTERCEPTOR_POINT.CELL_CONTENT);
Parameters
Parameter | Type |
---|---|
row | number |
col | number |
Returns
Nullable
<ICellDataForSheetInterceptor
>
ICellDataForSheetInterceptor
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:477
getCellDocumentModelWithFormula()
getCellDocumentModelWithFormula(cell): Nullable<IDocumentLayoutObject>
Parameters
Parameter | Type |
---|---|
cell | ICellData |
Returns
Nullable
<IDocumentLayoutObject
>
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:1150
getCellInfoInMergeData()
getCellInfoInMergeData(row, column): ISelectionCell
Get cell info with merge data
Parameters
Parameter | Type | Description |
---|---|---|
row | number | The row index of the cell. |
column | number | The column index of the cell. |
Returns
- The cell info with merge data
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:423
getCellMatrix()
getCellMatrix(): ObjectMatrix<Nullable<ICellData>>
Returns WorkSheet Cell Data Matrix
Returns
ObjectMatrix
<Nullable
<ICellData
>>
WorkSheet Cell Data Matrix
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:218
getCellMatrixPrintRange()
getCellMatrixPrintRange(): null | {
endColumn: number;
endRow: number;
startColumn: number;
startRow: number;
}
Get worksheet printable cell range.
Returns
null
| {
endColumn
: number
;
endRow
: number
;
startColumn
: number
;
startRow
: number
;
}
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:227
getCellRaw()
getCellRaw(row, col): Nullable<ICellData>
Parameters
Parameter | Type |
---|---|
row | number |
col | number |
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:513
getCellStyleOnly()
getCellStyleOnly(row, col): Nullable<ICellDataForSheetInterceptor>
Get cellData only use effect on style interceptor
Parameters
Parameter | Type | Description |
---|---|---|
row | number | The row index of the cell. |
col | number | The column index of the cell. |
Returns
Nullable
<ICellDataForSheetInterceptor
>
The cell data only use effect on style interceptor
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:505
getCellValueOnly()
getCellValueOnly(row, col): Nullable<ICellDataForSheetInterceptor>
Get cellData only use effect on value interceptor
Parameters
Parameter | Type |
---|---|
row | number |
col | number |
Returns
Nullable
<ICellDataForSheetInterceptor
>
The cell data only use effect on value interceptor
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:491
getColumnCount()
getColumnCount(): number
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:655
getColumnManager()
getColumnManager(): ColumnManager
Returns Column Manager
Returns
ColumnManager
Column Manager
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:336
getColumnStyle()
getColumnStyle(column, keepRaw?): string | Nullable<IStyleData>
Get the style of the column.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
column | number | undefined | The column index |
keepRaw ? | boolean | false | If true, return the raw style data, otherwise return the style data object |
Returns
string
| Nullable
<IStyleData
>
The style of the column
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:130
getColumnWidth()
getColumnWidth(columnPosition): number
Gets the width in pixels of the given column.
Parameters
Parameter | Type | Description |
---|---|---|
columnPosition | number | column index |
Returns
number
Gets the width in pixels of the given column.
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:701
getColVisible()
getColVisible(col): boolean
Parameters
Parameter | Type |
---|---|
col | number |
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:752
getConfig()
getConfig(): IWorksheetData
Returns WorkSheet Configures
Returns
WorkSheet Configures
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:613
getDefaultCellStyle()
getDefaultCellStyle(): string | Nullable<IStyleData>
Get the default style of the worksheet.
Returns
string
| Nullable
<IStyleData
>
Default Style
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:197
getDefaultCellStyleInternal()
getDefaultCellStyleInternal(): Nullable<IStyleData>
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:201
getFreeze()
getFreeze(): IFreeze
Returns frozen.
Returns
frozen
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:621
getHiddenCols()
getHiddenCols(start?, end?): IRange[]
Parameters
Parameter | Type |
---|---|
start ? | number |
end ? | number |
Returns
IRange
[]
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:756
getHiddenRows()
getHiddenRows(start?, end?): IRange[]
Parameters
Parameter | Type |
---|---|
start ? | number |
end ? | number |
Returns
IRange
[]
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:744
getLastColumnWithContent()
getLastColumnWithContent(): number
Returns the position of the last column that has content.
Returns
number
the position of the last column that has content.
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:805
getLastRowWithContent()
getLastRowWithContent(): number
Returns the position of the last row that has content.
Returns
number
the position of the last row that has content.
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:797
getMatrixWithMergedCells()
getMatrixWithMergedCells(
row,
col,
endRow,
endCol,
isRaw): ObjectMatrix<ICellData & {
colSpan: number;
rowSpan: number;
}>
Get cell matrix from a given range and pick out non-first cells of merged cells.
Notice that ICellData
here is not after copying. In another word, the object matrix here should be
considered as a slice of the original worksheet data matrix.
Parameters
Parameter | Type | Default value |
---|---|---|
row | number | undefined |
col | number | undefined |
endRow | number | undefined |
endCol | number | undefined |
isRaw | boolean | false |
Returns
ObjectMatrix
<ICellData
& {
colSpan
: number
;
rowSpan
: number
;
}>
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:527
getMaxColumns()
getMaxColumns(): number
Returns the current number of columns in the sheet, regardless of content.
Returns
number
the current number of columns in the sheet, regardless of content
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:629
getMaxRows()
getMaxRows(): number
Returns the current number of rows in the sheet, regardless of content.
Returns
number
the current number of rows in the sheet, regardless of content
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:640
getMergeData()
getMergeData(): IRange[]
Get the merged cell list of the sheet.
Returns
IRange
[]
merged cell list
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:364
getMergedCell()
getMergedCell(row, col): Nullable<IRange>
Get the merged cell Range of the sheet cell.
Parameters
Parameter | Type | Description |
---|---|---|
row | number | The row index of test cell |
col | number | The column index of test cell |
Returns
The merged cell range of the cell, if the cell is not in a merged cell, return null
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:374
getMergedCellRange()
getMergedCellRange(
startRow,
startColumn,
endRow,
endColumn): IRange[]
Get the merged cell info list which has intersection with the given range.
Parameters
Parameter | Type | Description |
---|---|---|
startRow | number | The start row index of the range |
startColumn | number | The start column index of the range |
endRow | number | The end row index of the range |
endColumn | number | The end column index of the range |
Returns
IRange
[]
The merged cell info list which has intersection with the given range or empty array if no merged cell in the range
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:386
getName()
getName(): string
Returns the name of the sheet.
Returns
string
name of the sheet
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:344
getRange()
getRange(range)
getRange(range): Range
Parameters
Parameter | Type |
---|---|
range | IRange |
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:570
getRange(startRow, startColumn)
getRange(startRow, startColumn): Range
Parameters
Parameter | Type |
---|---|
startRow | number |
startColumn | number |
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:571
getRange(startRow, startColumn, endRow, endColumn)
getRange(
startRow,
startColumn,
endRow,
endColumn): Range
Parameters
Parameter | Type |
---|---|
startRow | number |
startColumn | number |
endRow | number |
endColumn | number |
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:572
getRowCount()
getRowCount(): number
Returns
number
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:647
getRowFiltered()
getRowFiltered(row): boolean
Parameters
Parameter | Type |
---|---|
row | number |
Returns
boolean
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:517
getRowHeight()
getRowHeight(row): number
Gets the height in pixels of the given row.
Parameters
Parameter | Type | Description |
---|---|---|
row | number | row index |
Returns
number
Gets the height in pixels of the given row.
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:710
getRowManager()
getRowManager(): RowManager
Returns Row Manager
Returns
RowManager
Row Manager
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:313
getRowRawVisible()
getRowRawVisible(row): boolean
Get if the row does not have hidden
property. This value won’t affected by features like filter and view.
Parameters
Parameter | Type | Description |
---|---|---|
row | number | the row index |
Returns
boolean
if the row does not have hidden
property
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:740
getRowStyle()
getRowStyle(row, keepRaw?): string | Nullable<IStyleData>
Get the style of the row.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
row | number | undefined | The row index |
keepRaw ? | boolean | false | If true, return the raw style data, otherwise return the style data object |
Returns
string
| Nullable
<IStyleData
>
The style of the row
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:152
getRowVisible()
getRowVisible(row): boolean
Get if the row is visible. It may be affected by features like filter and view.
Parameters
Parameter | Type | Description |
---|---|---|
row | number | the row index |
Returns
boolean
if the row in visible to the user
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:731
getScrollLeftTopFromSnapshot()
getScrollLeftTopFromSnapshot(): {
scrollLeft: number;
scrollTop: number;
}
Returns
{
scrollLeft: number;
scrollTop: number;
}
Name | Type | Defined in |
---|---|---|
scrollLeft | number | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:596 |
scrollTop | number | packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:597 |
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:594
getSheetId()
getSheetId(): string
Returns the ID of the sheet represented by this object.
Returns
string
ID of the sheet
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:328
getSnapshot()
getSnapshot(): IWorksheetData
Returns
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:107
getSpanModel()
getSpanModel(): SpanModel
Returns
SpanModel
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:120
getTabColor()
getTabColor(): Nullable<string>
Gets the sheet tab color, or null if the sheet tab has no color.
Returns
Nullable
<string
>
the sheet tab color or null
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:689
getUnitId()
getUnitId(): string
Returns the ID of its parent unit.
Returns
string
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:320
getVisibleCols()
getVisibleCols(): IRange[]
Get all visible columns in the sheet.(not include filter & view)
Returns
IRange
[]
Visible columns range list
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:777
getVisibleRows()
getVisibleRows(): IRange[]
Get all visible rows in the sheet.(not include filter & view, like getRawVisibleRows)
Returns
IRange
[]
Visible rows range list
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:768
getZoomRatio()
getZoomRatio(): number
Return WorkSheetZoomRatio
Returns
number
zoomRatio
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:605
hasHiddenGridlines()
hasHiddenGridlines(): boolean
Returns true if the sheet’s gridlines are hidden; otherwise returns false. Gridlines are visible by default.
Returns
boolean
Gridlines Hidden Status
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:675
isColumnContainsMergedCell()
isColumnContainsMergedCell(column): boolean
Get if the column contains merged cell
Parameters
Parameter | Type | Description |
---|---|---|
column | number | The column index |
Returns
boolean
Is merge cell across column
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:404
isRightToLeft()
isRightToLeft(): BooleanNumber
Returns true if this sheet layout is right-to-left. Returns false if the sheet uses the default left-to-right layout.
Returns
true if this sheet layout is right-to-left. Returns false if the sheet uses the default left-to-right layout.
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:786
isRowContainsMergedCell()
isRowContainsMergedCell(row): boolean
Get if the row contains merged cell
Parameters
Parameter | Type | Description |
---|---|---|
row | number | The row index |
Returns
boolean
Is merge cell across row
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:395
isRowFiltered()
isRowFiltered(row): boolean
Row is filtered out, that means this row is invisible.
Parameters
Parameter | Type |
---|---|
row | number |
Returns
boolean
is row hidden by filter
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:722
isSheetHidden()
isSheetHidden(): BooleanNumber
isSheetHidden
Returns
hidden status of sheet
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:667
iterateByColumn()
iterateByColumn(
range,
skipEmpty,
skipNonTopLeft): Iterable<Readonly<ICell>, any, any>
Iterate a range column by column. This is pretty similar to iterateByRow
but with different order.
Performance intensive.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
range | IRange | undefined | The iterate range. |
skipEmpty | boolean | true | Whether to skip empty cells, default to be true . |
skipNonTopLeft | boolean | true | Whether to skip non-top-left cells of merged cells, default to be true . If the parameter is set to false , the iterator will return cells in the top row. |
Returns
Iterable
<Readonly
<ICell
>, any
, any
>
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:896
iterateByRow()
iterateByRow(range, skipEmpty): Iterable<Readonly<ICell>, any, any>
Iterate a range row by row.
Performance intensive.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
range | IRange | undefined | the iterate range |
skipEmpty | boolean | true | whether to skip empty cells, default to be true |
Returns
Iterable
<Readonly
<ICell
>, any
, any
>
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:825
mixinDefaultStyleToCellRaw()
mixinDefaultStyleToCellRaw(
row,
col,
cellRaw,
isRowStylePrecedeColumnStyle): void
this function is used to mixin default style to cell raw{number}
Parameters
Parameter | Type | Description |
---|---|---|
row | number | The row index |
col | number | The column index |
cellRaw | Nullable <ICellData > | The cell raw data |
isRowStylePrecedeColumnStyle | boolean | The priority of row style and column style |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:175
setColumnCount()
setColumnCount(count): void
Parameters
Parameter | Type |
---|---|
count | number |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:659
setColumnStyle()
setColumnStyle(column, style): void
Set the style of the column.
Parameters
Parameter | Type | Description |
---|---|---|
column | number | The column index |
style | string | Nullable <IStyleData > | The style to be set |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:142
setDefaultCellStyle()
setDefaultCellStyle(style): void
Set Default Style, if the style has been set, all cells style will be base on this style.
Parameters
Parameter | Type | Description |
---|---|---|
style | string | Nullable <IStyleData > | The style to be set as default style |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:210
setMergeData()
setMergeData(mergeData): void
Set the merge data of the sheet, all the merged cells will be rebuilt.
Parameters
Parameter | Type |
---|---|
mergeData | IRange [] |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:115
setRowCount()
setRowCount(count): void
Parameters
Parameter | Type |
---|---|
count | number |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:651
setRowStyle()
setRowStyle(row, style): void
Set the style of the row.
Parameters
Parameter | Type | Description |
---|---|---|
row | number | - |
style | string | Nullable <IStyleData > | The style to be set |
Returns
void
Defined in
packages/api/tmp/univer-pro/submodules/univer/packages/core/src/sheets/worksheet.ts:164