FWorksheet
| packages | @univerjs/sheets |
|---|
A Facade API object bounded to a worksheet. It provides a set of methods to interact with the worksheet.
APIs
activate
Activates this sheet. Does not alter the sheet itself, only the parent's notion of the active sheet.
Signature
activate(): FWorksheetReturns
- (
FWorksheet) — Current sheet, for chaining.
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorkSheets = fWorkbook.getSheets()
// activate the last sheet
fWorkSheets[fWorkSheets.length - 1].activate()appendRow
Appends a row to the bottom of the current data region in the sheet. If a cell's content begins with =, it's interpreted as a formula.
Signature
appendRow(rowContents: CellValue[]): FWorksheetParameters
rowContents(CellValue[]) — - An array of values for the new row.
Returns
- (
FWorksheet) — Returns the current worksheet instance for method chaining.
Examples
// Appends a new row with 4 columns to the bottom of the current
// data region in the sheet containing the values in the array.
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorkSheet = fWorkbook.getActiveSheet()
fWorkSheet.appendRow([1, 'Hello Univer', true, '=A1'])autoFitRow
Make certain row wrap and auto height.
Signature
autoFitRow(rowPosition: number, auto?: BooleanNumber = BooleanNumber.TRUE): FWorksheetParameters
rowPosition(number) — - The row position to change.auto(BooleanNumber) — - Whether to auto fit the row height.
Returns
- (
FWorksheet) — This worksheet instance for chaining
Examples
const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet()
fWorkSheet.autoFitRow(24)cancelFreeze
Cancels the frozen state of the current sheet.
Signature
cancelFreeze(): FWorksheetReturns
- (
FWorksheet) — This worksheet instance for chaining
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Cancel freeze
fWorksheet.cancelFreeze()clear
Clears the sheet of content and formatting information.Or Optionally clears only the contents or only the formatting.
Signature
clear(options?: IFacadeClearOptions): FWorksheetParameters
options(IFacadeClearOptions) — - Options for clearing the sheet. If not provided, the contents and formatting are cleared both.options.contentsOnly— - If true, the contents of the sheet are cleared. If false, the contents and formatting are cleared. Default is false.options.formatOnly— - If true, the formatting of the sheet is cleared. If false, the contents and formatting are cleared. Default is false.
Returns
- (
FWorksheet) — Returns the current worksheet instance for method chaining
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorkSheet = fWorkbook.getActiveSheet()
// clear the sheet of content and formatting information
fWorkSheet.clear()
// clear the sheet of content only
fWorkSheet.clear({ contentsOnly: true })clearContents
Clears the sheet of contents, while preserving formatting information.
Signature
clearContents(): FWorksheetReturns
- (
FWorksheet) — Returns the current worksheet instance for method chaining
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorkSheet = fWorkbook.getActiveSheet()
// clear the sheet of content only
fWorkSheet.clearContents()clearFormats
Clears the sheet of formatting, while preserving contents.
Signature
clearFormats(): FWorksheetReturns
- (
FWorksheet) — Returns the current worksheet instance for method chaining
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorkSheet = fWorkbook.getActiveSheet()
// clear the sheet of formatting only
fWorkSheet.clearFormats()deleteColumn
Deletes the column at the given column position.
Signature
deleteColumn(columnPosition: number): FWorksheetParameters
columnPosition(number) — - The position of the column, starting at 0 for the first column
Returns
- (
FWorksheet) — This sheet, for chaining
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Delete column C
fWorksheet.deleteColumn(2)
// Delete column A
fWorksheet.deleteColumn(0)deleteColumns
Deletes a number of columns starting at the given column position.
Signature
deleteColumns(columnPosition: number, howMany: number): FWorksheetParameters
columnPosition(number) — - The position of the first column to delete, starting at 0 for the first columnhowMany(number) — - The number of columns to delete
Returns
- (
FWorksheet) — This sheet, for chaining
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Delete 3 columns at column index 2 (columns C, D, E)
fWorksheet.deleteColumns(2, 3)
// Delete 1 column at column index 0 (column A)
fWorksheet.deleteColumns(0, 1)deleteColumnsByPoints
Deletes the columns specified by the given column points. Each point can be a single column index or a tuple representing a range of columns.
Signature
deleteColumnsByPoints(columnPoints: Array<number | [number, number]>): FWorksheetParameters
columnPoints(Array<number | [number, number]>) — - An array of column points to delete. Each point can be a single column index or a tuple representing a range of columns.
Returns
- (
FWorksheet) — This sheet, for chaining
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Delete columns at index 2, and range from index 4 to 6 (columns C, E-G)
fWorksheet.deleteColumnsByPoints([2, [4, 6]])deleteRow
Deletes the row at the given row position.
Signature
deleteRow(rowPosition: number): FWorksheetParameters
rowPosition(number) — - The position of the row, starting at 0 for the first row.
Returns
- (
FWorksheet) — This sheet, for chaining.
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Delete the third row
fWorksheet.deleteRow(2)
// Delete the first row
fWorksheet.deleteRow(0)deleteRows
Deletes a number of rows starting at the given row position.
Signature
deleteRows(rowPosition: number, howMany: number): FWorksheetParameters
rowPosition(number) — - The position of the first row to delete, starting at 0 for the first row.howMany(number) — - The number of rows to delete.
Returns
- (
FWorksheet) — This sheet, for chaining.
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Delete 3 rows at row index 2 (rows 3-5)
fWorksheet.deleteRows(2, 3)
// Delete 1 row at row index 0 (first row)
fWorksheet.deleteRows(0, 1)deleteRowsByPoints
Deletes the rows specified by the given row points. Each point can be a single row index or a tuple representing a range of rows.
Signature
deleteRowsByPoints(rowPoints: Array<number | [number, number]>): FWorksheetParameters
rowPoints(Array<number | [number, number]>) — - An array of row points to delete. Each point can be a single row index or a tuple representing a range of rows.
Returns
- (
FWorksheet) — This sheet, for chaining.
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Delete rows at index 2, and range from index 4 to 6 (rows 3, 5-7)
fWorksheet.deleteRowsByPoints([2, [4, 6]])dispose
Signature
dispose(): voidequalTo
Judge whether provided FWorksheet is equal to current.
Signature
equalTo(other: FWorksheet): booleanParameters
other(FWorksheet) — - the FWorksheet to compare with.
Returns
- (
boolean) — true if the FWorksheet is equal to the current FWorksheet, false otherwise.
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const sheets = fWorkbook.getSheets()
const fWorkSheet = fWorkbook.getActiveSheet()
console.log(fWorkSheet.equalTo(sheets[0])) // true, if the active sheet is the first sheet.getActiveCell
Returns the active cell in this sheet.
Signature
getActiveCell(): FRange | nullReturns
- (
FRange | null) — The active cell
Examples
const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet()
console.log(fWorkSheet.getActiveCell().getA1Notation())getActiveRange
Returns the selected range in the active sheet, or null if there is no active range.
Signature
getActiveRange(): FRange | nullReturns
- (
FRange | null) — the active range
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Get the currently active range
const activeRange = fWorksheet.getActiveRange()
if (activeRange) {
console.log('Active range:', activeRange.getA1Notation())
}getCellMergeData
Get the merged cell data of the specified row and column.
Signature
getCellMergeData(row: number, column: number): FRange | undefinedParameters
row(number) — - The row indexcolumn(number) — - The column index
Returns
- (
FRange | undefined) — The merged cell data, or undefined if the cell is not merged
Examples
const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet()
const merge = fWorkSheet.getCellMergeData(0, 0)
if (merge) {
console.log('Merged range:', merge.getA1Notation())
}getColumnCustomMetadata
Get custom metadata of column
Signature
getColumnCustomMetadata(index: number): CustomData | undefinedParameters
index(number) — - column index
Returns
- (
CustomData | undefined) — custom metadata
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorkSheet = fWorkbook.getActiveSheet()
const custom = fWorkSheet.getColumnCustomMetadata(0)
console.log(custom)getColumnDefaultStyle
Get the default style of the worksheet column
Signature
getColumnDefaultStyle(index: number, keepRaw?: boolean = false): Nullable<IStyleData> | stringParameters
index(number) — - The column indexkeepRaw(boolean) — - If true, return the raw style data maybe the style name or style data, otherwise return the data from col manager
Returns
- (
Nullable<IStyleData> | string) — The default style of the worksheet column name or style data
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Get default style for column 0 (A)
const colStyle = fWorksheet.getColumnDefaultStyle(0)
console.log(colStyle)
// Get raw style data for column 0
const rawColStyle = fWorksheet.getColumnDefaultStyle(0, true)
console.log(rawColStyle)getColumnWidth
Gets the width in pixels of the given column.
Signature
getColumnWidth(columnPosition: number): numberParameters
columnPosition(number) — - The position of the column to examine. index starts at 0.
Returns
- (
number) — The width of the column in pixels
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorksheet = fWorkbook.getActiveSheet()
// Set the long text value in cell A1
const fRange = fWorksheet.getRange('A1')
fRange.setValue('Whenever it is a damp, drizzly November in my soul...')
// Set the column A to a width which fits the text
fWorksheet.autoResizeColumn(0)
// Get the width of the column A
console.log(fWorksheet.getColumnWidth(0))getCustomMetadata
Get custom metadata of worksheet
Signature
getCustomMetadata(): CustomData | undefinedReturns
- (
CustomData | undefined) — custom metadata
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorkSheet = fWorkbook.getActiveSheet()
const custom = fWorkSheet.getCustomMetadata()
console.log(custom)getDataRange
Returns a Range corresponding to the dimensions in which data is present. This is functionally equivalent to creating a Range bounded by A1 and (Sheet.getLastColumn(), Sheet.getLastRow()).
Signature
getDataRange(): FRangeReturns
- (
FRange) — The range of the data in the sheet.
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorkSheet = fWorkbook.getActiveSheet()
// Assume the sheet is a empty sheet
const cellRange = fWorkSheet.getRange('J50')
cellRange.setValue('Hello World')
console.log(fWorkSheet.getDataRange().getA1Notation()) // A1:J50getDefaultStyle
Get the default style of the worksheet.
Signature
getDefaultStyle(): Nullable<IStyleData> | stringReturns
- (
Nullable<IStyleData> | string) — Default style of the worksheet.
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
const defaultStyle = fWorksheet.getDefaultStyle()
console.log(defaultStyle)getDefinedNames
Get all the defined names in the worksheet.
Signature
getDefinedNames(): FDefinedName[]Returns
- (
FDefinedName[]) — All the defined names in the worksheet
Examples
// The code below gets all the defined names in the worksheet
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
const definedNames = fWorksheet.getDefinedNames()
console.log(definedNames, definedNames[0]?.getFormulaOrRefString())getFreeze
Get the freeze state of the current sheet.
Signature
getFreeze(): IFreezeReturns
- (
IFreeze) — The freeze state of the current sheet
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Get the freeze state of the current sheet
const freeze = fWorksheet.getFreeze()
console.log(freeze)getFrozenColumnRange
Get freezed columns
Signature
getFrozenColumnRange(): IColumnRangeReturns
- (
IColumnRange) — The range of the frozen columns.
Examples
const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Get the range of the frozen columns
const frozenColumns = fWorkSheet.getFrozenColumnRange()
console.log(frozenColumns)getFrozenColumns
Get the number of frozen columns.
Signature
getFrozenColumns(): numberReturns
- (
number) — The number of frozen columns, returns 0 if no columns are frozen.
Examples
const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Get the number of frozen columns
const frozenColumns = fWorkSheet.getFrozenColumns()
console.log(frozenColumns)getFrozenRowRange
Get freezed rows.
Signature
getFrozenRowRange(): IRowRangeReturns
- (
IRowRange) — The range of the frozen rows.
Examples
const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Get the range of the frozen rows
const frozenRows = fWorkSheet.getFrozenRowRange()
console.log(frozenRows)getFrozenRows
Get the number of frozen rows.
Signature
getFrozenRows(): numberReturns
- (
number) — The number of frozen rows. returns 0 if no rows are frozen.
Examples
const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Get the number of frozen rows
const frozenRows = fWorkSheet.getFrozenRows()
console.log(frozenRows)getGridLinesColor
Get the color of the gridlines in the sheet.
Signature
getGridLinesColor(): string | undefinedReturns
- (
string | undefined) — The color of the gridlines in the sheet or undefined. The default color is 'rgb(214, 216, 219)'.
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorkSheet = fWorkbook.getActiveSheet()
// get the gridlines color of the sheet
console.log(fWorkSheet.getGridLinesColor())getIndex
Gets the position of the sheet in its parent spreadsheet. Starts at 0.
Signature
getIndex(): numberReturns
- (
number) — The position of the sheet in its parent spreadsheet.
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorkSheet = fWorkbook.getActiveSheet()
// get the position of the active sheet
const position = fWorkSheet.getIndex()
console.log(position)getInject
Get the injector instance.
Signature
getInject(): InjectorReturns
- (
Injector) — The injector instance.
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
const injector = fWorksheet.getInject()
console.log(injector)getLastColumn
Returns the column index of the last column that contains content.
Signature
getLastColumn(): numberReturns
- (
number) — the column index of the last column that contains content.
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorkSheet = fWorkbook.getActiveSheet()
// Assume the sheet is a empty sheet
const cellRange = fWorkSheet.getRange('J50')
cellRange.setValue('Hello World')
console.log(fWorkSheet.getLastColumn()) // 9getLastColumns
Deprecated
use getLastColumn instead.
Returns the column index of the last column that contains content.
Signature
getLastColumns(): numberReturns
- (
number) — the column index of the last column that contains content.
getLastRow
Returns the row index of the last row that contains content.
Signature
getLastRow(): numberReturns
- (
number) — the row index of the last row that contains content.
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorkSheet = fWorkbook.getActiveSheet()
// Assume the sheet is a empty sheet
const cellRange = fWorkSheet.getRange('J50')
cellRange.setValue('Hello World')
console.log(fWorkSheet.getLastRow()) // 49getLastRows
Deprecated
use getLastRow instead.
Returns the row index of the last row that contains content.
Signature
getLastRows(): numberReturns
- (
number) — the row index of the last row that contains content.
getMaxColumns
Returns the current number of columns in the sheet, regardless of content.
Signature
getMaxColumns(): numberReturns
- (
number) — The maximum columns count of the sheet
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
const totalColumns = fWorksheet.getMaxColumns()
console.log(`Sheet has ${totalColumns} columns`)getMaxRows
Returns the current number of rows in the sheet, regardless of content.
Signature
getMaxRows(): numberReturns
- (
number) — The maximum rows count of the sheet
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
const totalRows = fWorksheet.getMaxRows()
console.log(`Sheet has ${totalRows} rows`)getMergeData
Get all merged cells in the current worksheet
Signature
getMergeData(): FRange[]Returns
- (
FRange[]) — All the merged cells in the worksheet
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Get all merged ranges in the sheet
const mergedData = fWorksheet.getMergeData()
// Process each merged range
mergedData.forEach((range) => {
console.log(range.getA1Notation())
})getMergedRanges
Get all merged cells in the current sheet
Signature
getMergedRanges(): FRange[]Returns
- (
FRange[]) — all merged cells
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Get all merged ranges in the sheet
const mergedRanges = fWorksheet.getMergedRanges()
// Process each merged range
mergedRanges.forEach((range) => {
console.log(range.getA1Notation())
})getRange
Signature
getRange(rowOrA1Notation: IRange | number | string, column?: number, numRows?: number, numColumns?: number): FRangegetRowCustomMetadata
Get custom metadata of row
Signature
getRowCustomMetadata(index: number): CustomData | undefinedParameters
index(number) — - row index
Returns
- (
CustomData | undefined) — custom metadata
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorkSheet = fWorkbook.getActiveSheet()
const custom = fWorkSheet.getRowCustomMetadata(0)
console.log(custom)getRowDefaultStyle
Get the default style of the worksheet row
Signature
getRowDefaultStyle(index: number, keepRaw?: boolean = false): Nullable<IStyleData> | stringParameters
index(number) — - The row indexkeepRaw(boolean) — - If true, return the raw style data maybe the style name or style data, otherwise return the data from row manager
Returns
- (
Nullable<IStyleData> | string) — The default style of the worksheet row name or style data
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Get default style for row 0 (1)
const rowStyle = fWorksheet.getRowDefaultStyle(0)
console.log(rowStyle)
// Get raw style data for row 0
const rawRowStyle = fWorksheet.getRowDefaultStyle(0, true)
console.log(rawRowStyle)getRowHeight
Gets the height in pixels of the given row.
Signature
getRowHeight(rowPosition: number): numberParameters
rowPosition(number) — - The position of the row to examine. index starts at 0.
Returns
- (
number) — The height in pixels of the given row.
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorksheet = fWorkbook.getActiveSheet()
// Set the value of the cell A1 to 'Hello, Univer!', set the font size to 30 and font weight to bold
const fRange = fWorksheet.getRange('A1')
fRange.setValue('Hello, Univer!').setFontSize(30).setFontWeight('bold')
// Get the height of the first row
console.log(fWorksheet.getRowHeight(0))getSelection
Get the current selection of the worksheet.
Signature
getSelection(): FSelection | nullReturns
- (
FSelection | null) — return the current selections of the worksheet or null if there is no selection.
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
const selection = fWorksheet.getSelection()
console.log(selection)getSheet
Get the worksheet instance.
Signature
getSheet(): WorksheetReturns
- (
Worksheet) — The worksheet instance.
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
const sheet = fWorksheet.getSheet()
console.log(sheet)getSheetId
Get the worksheet id.
Signature
getSheetId(): stringReturns
- (
string) — The id of the worksheet.
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
const sheetId = fWorksheet.getSheetId()
console.log(sheetId)getSheetName
Get the worksheet name.
Signature
getSheetName(): stringReturns
- (
string) — The name of the worksheet.
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
const sheetName = fWorksheet.getSheetName()
console.log(sheetName)getTabColor
Get the tab color of the sheet.
Signature
getTabColor(): string | undefinedReturns
- (
string | undefined) — The tab color of the sheet or undefined. The default color is css style property 'unset'.
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorkSheet = fWorkbook.getActiveSheet()
// get the tab color of the sheet
console.log(fWorkSheet.getTabColor())getWorkbook
Get the workbook instance.
Signature
getWorkbook(): WorkbookReturns
- (
Workbook) — The workbook instance.
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
const workbook = fWorksheet.getWorkbook()
console.log(workbook)getWorksheetPermission
Get the WorksheetPermission instance for managing worksheet-level permissions. This is the new permission API that provides worksheet-specific permission control.
Signature
getWorksheetPermission(): FWorksheetPermissionReturns
- (
FWorksheetPermission) — - The WorksheetPermission instance.
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
const permission = fWorksheet.getWorksheetPermission()
// Set worksheet to read-only mode
await permission.setMode('readOnly')
// Check if a specific cell can be edited
const canEdit = permission.canEditCell(0, 0)
// Protect multiple ranges at once
const range1 = fWorksheet.getRange('A1:B10')
const range2 = fWorksheet.getRange('D1:E10')
await permission.protectRanges([
{ ranges: [range1], options: { name: 'Range 1', allowEdit: false } },
{ ranges: [range2], options: { name: 'Range 2', allowEdit: false } },
])
// Subscribe to permission changes
permission.permission$.subscribe((snapshot) => {
console.log('Worksheet permissions changed:', snapshot)
})hasHiddenGridLines
Returns true if the sheet's gridlines are hidden; otherwise returns false. Gridlines are visible by default.
Signature
hasHiddenGridLines(): booleanReturns
- (
boolean) — True if the sheet's gridlines are hidden; otherwise false.
Examples
const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet()
// check if the gridlines are hidden
if (fWorkSheet.hasHiddenGridLines()) {
console.log('Gridlines are hidden')
}hideColumn
Hides the column or columns in the given range.
Signature
hideColumn(column: FRange): FWorksheetParameters
column(FRange) — - The column range to hide
Returns
- (
FWorksheet) — This sheet, for chaining
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Hide columns C, D, E
const column1 = fWorksheet.getRange('C:E')
fWorksheet.hideColumn(column1)
// Hide column A
const column2 = fWorksheet.getRange('A:A')
fWorksheet.hideColumn(column2)hideColumns
Hides one or more consecutive columns starting at the given index. Use 0-index for this method
Signature
hideColumns(columnIndex: number, numColumn?: number = 1): FWorksheetParameters
columnIndex(number) — - The starting index of the columns to hidenumColumn(number) — - The number of columns to hide
Returns
- (
FWorksheet) — This sheet, for chaining
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Hide columns C, D, E
fWorksheet.hideColumns(2, 3)
// Hide column A
fWorksheet.hideColumns(0, 1)hideRow
Hides the rows in the given range.
Signature
hideRow(row: FRange): FWorksheetParameters
row(FRange) — - The row range to hide.
Returns
- (
FWorksheet) — This sheet, for chaining.
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Hide 3 rows starting from row index 1 (rows 2-4)
const row1 = fWorksheet.getRange('2:4')
fWorksheet.hideRow(row1)
// Hide single row at index 0 (first row)
const row2 = fWorksheet.getRange('1:1')
fWorksheet.hideRow(row2)hideRows
Hides one or more consecutive rows starting at the given index. Use 0-index for this method
Signature
hideRows(rowIndex: number, numRow?: number = 1): FWorksheetParameters
rowIndex(number) — - The starting index of the rows to hidenumRow(number) — - The number of rows to hide
Returns
- (
FWorksheet) — This sheet, for chaining.
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Hide 3 rows starting from row index 1 (rows 2-4)
fWorksheet.hideRows(1, 3)
// Hide single row at index 0 (first row)
fWorksheet.hideRows(0)hideSheet
Hides this sheet. Has no effect if the sheet is already hidden. If this method is called on the only visible sheet, it throws an exception.
Signature
hideSheet(): FWorksheetReturns
- (
FWorksheet) — Returns the current worksheet instance for method chaining
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorkSheet = fWorkbook.getActiveSheet()
// hide the active sheet
fWorkSheet.hideSheet()insertColumnAfter
Inserts a column after the given column position.
Signature
insertColumnAfter(afterPosition: number): FWorksheetParameters
afterPosition(number) — - The column after which the new column should be added, starting at 0 for the first column
Returns
- (
FWorksheet) — This worksheet instance for chaining
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Insert a column after column C
fWorksheet.insertColumnAfter(2)
// Insert a column after column A
fWorksheet.insertColumnAfter(0)insertColumnBefore
Inserts a column before the given column position.
Signature
insertColumnBefore(beforePosition: number): FWorksheetParameters
beforePosition(number) — - The column before which the new column should be added, starting at 0 for the first column
Returns
- (
FWorksheet) — This worksheet instance for chaining
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Insert a column before column C
fWorksheet.insertColumnBefore(2)
// Insert a column before column A
fWorksheet.insertColumnBefore(0)insertColumns
Inserts one or more consecutive blank columns in a sheet starting at the specified location.
Signature
insertColumns(columnIndex: number, numColumns?: number = 1): FWorksheetParameters
columnIndex(number) — - The index indicating where to insert a column, starting at 0 for the first columnnumColumns(number) — - The number of columns to insert
Returns
- (
FWorksheet) — This sheet, for chaining
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Insert 3 columns before column C
fWorksheet.insertColumns(2, 3)
// Insert 1 column before column A
fWorksheet.insertColumns(0)insertColumnsAfter
Inserts a given number of columns after the given column position.
Signature
insertColumnsAfter(afterPosition: number, howMany: number): FWorksheetParameters
afterPosition(number) — - The column after which the new columns should be added, starting at 0 for the first columnhowMany(number) — - The number of columns to insert
Returns
- (
FWorksheet) — This sheet, for chaining
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Insert 3 columns after column C
fWorksheet.insertColumnsAfter(2, 3)
// Insert 1 column after column A
fWorksheet.insertColumnsAfter(0, 1)insertColumnsBefore
Inserts a number of columns before the given column position.
Signature
insertColumnsBefore(beforePosition: number, howMany: number): FWorksheetParameters
beforePosition(number) — - The column before which the new columns should be added, starting at 0 for the first columnhowMany(number) — - The number of columns to insert
Returns
- (
FWorksheet) — This sheet, for chaining
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Insert 3 columns before column C
fWorksheet.insertColumnsBefore(2, 3)
// Insert 1 column before column A
fWorksheet.insertColumnsBefore(0, 1)insertDefinedName
Insert a defined name for worksheet.
Signature
insertDefinedName(name: string, formulaOrRefString: string): voidParameters
name(string) — - The name of the defined name to insertformulaOrRefString(string) — - The formula(=sum(A2:b10)) or reference(A1) string of the defined name to insert
Examples
// The code below inserts a defined name
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
fWorksheet.insertDefinedName('MyDefinedName', 'Sheet1!$A$1')insertRowAfter
Inserts a row after the given row position.
Signature
insertRowAfter(afterPosition: number): FWorksheetParameters
afterPosition(number) — - The row after which the new row should be added, starting at 0 for the first row.
Returns
- (
FWorksheet) — This sheet, for chaining.
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Insert a row after the third row
fWorksheet.insertRowAfter(2)
// Insert a row after the first row
fWorksheet.insertRowAfter(0)insertRowBefore
Inserts a row before the given row position.
Signature
insertRowBefore(beforePosition: number): FWorksheetParameters
beforePosition(number) — - The row before which the new row should be added, starting at 0 for the first row.
Returns
- (
FWorksheet) — This sheet, for chaining.
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Insert a row before the third row
fWorksheet.insertRowBefore(2)
// Insert a row before the first row
fWorksheet.insertRowBefore(0)insertRows
Inserts one or more consecutive blank rows in a sheet starting at the specified location.
Signature
insertRows(rowIndex: number, numRows?: number = 1): FWorksheetParameters
rowIndex(number) — - The index indicating where to insert a row, starting at 0 for the first row.numRows(number) — - The number of rows to insert.
Returns
- (
FWorksheet) — This sheet, for chaining.
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Insert 3 rows before the third row
fWorksheet.insertRows(2, 3)
// Insert 1 row before the first row
fWorksheet.insertRows(0)insertRowsAfter
Inserts a number of rows after the given row position.
Signature
insertRowsAfter(afterPosition: number, howMany: number): FWorksheetParameters
afterPosition(number) — - The row after which the new rows should be added, starting at 0 for the first row.howMany(number) — - The number of rows to insert.
Returns
- (
FWorksheet) — This sheet, for chaining.
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Insert 3 rows after the third row
fWorksheet.insertRowsAfter(2, 3)
// Insert 1 row after the first row
fWorksheet.insertRowsAfter(0, 1)insertRowsBefore
Inserts a number of rows before the given row position.
Signature
insertRowsBefore(beforePosition: number, howMany: number): FWorksheetParameters
beforePosition(number) — - The row before which the new rows should be added, starting at 0 for the first row.howMany(number) — - The number of rows to insert.
Returns
- (
FWorksheet) — This sheet, for chaining.
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Insert 3 rows before the third row
fWorksheet.insertRowsBefore(2, 3)
// Insert 1 row before the first row
fWorksheet.insertRowsBefore(0, 1)isSheetHidden
Returns true if the sheet is currently hidden.
Signature
isSheetHidden(): booleanReturns
- (
boolean) — True if the sheet is hidden; otherwise, false.
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorkSheets = fWorkbook.getSheets()
// check if the last sheet is hidden
console.log(fWorkSheets[fWorkSheets.length - 1].isSheetHidden())moveColumns
Moves the columns selected by the given range to the position indicated by the destinationIndex. The columnSpec itself does not have to exactly represent an entire column or group of columns to move—it selects all columns that the range spans.
Signature
moveColumns(columnSpec: FRange, destinationIndex: number): FWorksheetParameters
columnSpec(FRange) — - A range spanning the columns that should be moveddestinationIndex(number) — - The index that the columns should be moved to. Note that this index is based on the coordinates before the columns are moved. Existing data is shifted right to make room for the moved columns while the source columns are removed from the grid. Therefore, the data may end up at a different index than originally specified. Use 0-index for this method
Returns
- (
FWorksheet) — This sheet, for chaining
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Move columns C, D, E to column index 2 (columns B, C, D)
const columnSpec1 = fWorksheet.getRange('C:E')
fWorksheet.moveColumns(columnSpec1, 1)
// Move column F to column index 0 (column A)
const columnSpec2 = fWorksheet.getRange('F:F')
fWorksheet.moveColumns(columnSpec2, 0)moveRows
Moves the rows selected by the given range to the position indicated by the destinationIndex. The rowSpec itself does not have to exactly represent an entire row or group of rows to move—it selects all rows that the range spans.
Signature
moveRows(rowSpec: FRange, destinationIndex: number): FWorksheetParameters
rowSpec(FRange) — - A range spanning the rows that should be moved.destinationIndex(number) — - The index that the rows should be moved to. Note that this index is based on the coordinates before the rows are moved. Existing data is shifted down to make room for the moved rows while the source rows are removed from the grid. Therefore, the data may end up at a different index than originally specified. Use 0-index for this method.
Returns
- (
FWorksheet) — This sheet, for chaining.
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Move 3 rows at row index 2 (rows 3-5) to row index 0
const rowSpec1 = fWorksheet.getRange('3:5')
fWorksheet.moveRows(rowSpec1, 0)
// Move 1 row at row index 0 (first row) to row index 2
const rowSpec2 = fWorksheet.getRange('1:1')
fWorksheet.moveRows(rowSpec2, 2)onBeforeCellDataChange
Deprecated
use univerAPI.addEvent(univerAPI.Event.BeforeSheetEditEnd, (params) => \{\}) instead
Signature
onBeforeCellDataChange(callback: (cellValue: ObjectMatrix<Nullable<ICellData>>) => void): IDisposableonCellDataChange
Deprecated
use univerAPI.addEvent(univerAPI.Event.SheetValueChanged, (params) => \{\}) instead
Signature
onCellDataChange(callback: (cellValue: ObjectMatrix<Nullable<ICellData>>) => void): IDisposablesetActiveRange
Sets the active selection region for this sheet.
Signature
setActiveRange(range: FRange): FWorksheetParameters
range(FRange) — - The range to set as the active selection
Returns
- (
FWorksheet) — This sheet, for chaining
Examples
const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet()
fWorkSheet.setActiveRange(fWorkSheet.getRange('A10:B10'))setColumnCount
Sets the number of columns in the worksheet.
Signature
setColumnCount(columnCount: number): FWorksheetParameters
columnCount(number) — - The number of columns to set.
Returns
- (
FWorksheet) — Returns the current worksheet instance for method chaining.
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorkSheet = fWorkbook.getActiveSheet()
// Set the number of columns in the worksheet to 10
fWorkSheet.setColumnCount(10)setColumnCustom
Set custom properties for given columns.
Signature
setColumnCustom(custom: IObjectArrayPrimitiveType<CustomData>): FWorksheetParameters
custom(IObjectArrayPrimitiveType<CustomData>) — - The custom properties to set
Returns
- (
FWorksheet) — This worksheet instance for chaining
Examples
const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet()
fWorkSheet.setColumnCustom({ 0: { key: 'value' } })setColumnCustomMetadata
Set custom metadata of column
Signature
setColumnCustomMetadata(index: number, custom: CustomData | undefined): FWorksheetParameters
index(number) — - column indexcustom(CustomData | undefined) — - custom metadata
Returns
- (
FWorksheet) — Current worksheet, for chaining.
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorkSheet = fWorkbook.getActiveSheet()
fWorkSheet.setColumnCustomMetadata(0, { key: 'value' })setColumnDefaultStyle
Set the default style of the worksheet row
Signature
setColumnDefaultStyle(index: number, style: string | Nullable<IStyleData>): FWorksheetParameters
index(number) — - The row indexstyle(string | Nullable<IStyleData>) — - The style name or style data
Returns
- (
FWorksheet) — This sheet, for chaining.
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorksheet = fWorkbook.getActiveSheet()
fWorksheet.setColumnDefaultStyle(0, 'default')
// or
// fWorksheet.setColumnDefaultStyle(0, {fs: 12, ff: 'Arial'});setColumnWidth
Sets the width of the given column in pixels.
Signature
setColumnWidth(columnPosition: number, width: number): FWorksheetParameters
columnPosition(number) — - The position of the given column to setwidth(number) — - The width in pixels to set it to
Returns
- (
FWorksheet) — This sheet, for chaining
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Set width of column B to 100 pixels
fWorksheet.setColumnWidth(1, 100)setColumnWidths
Sets the width of the given columns in pixels.
Signature
setColumnWidths(startColumn: number, numColumn: number, width: number): FWorksheetParameters
startColumn(number) — - The starting column position to changenumColumn(number) — - The number of columns to changewidth(number) — - The width in pixels to set it to
Returns
- (
FWorksheet) — This sheet, for chaining
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Set width of columns B-D (index 1-3) to 100 pixels
fWorksheet.setColumnWidths(1, 3, 100)setCustomMetadata
Set custom metadata of worksheet
Signature
setCustomMetadata(custom: CustomData | undefined): FWorksheetParameters
custom(CustomData | undefined) — - custom metadata
Returns
- (
FWorksheet) — Current worksheet, for chaining.
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorkSheet = fWorkbook.getActiveSheet()
fWorkSheet.setCustomMetadata({ key: 'value' })setDefaultStyle
Set the default style of the worksheet
Signature
setDefaultStyle(style: string | Nullable<IStyleData>): FWorksheetParameters
style(string | Nullable<IStyleData>) — - The style to set
Returns
- (
FWorksheet) — This worksheet instance for chaining
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
fWorksheet.setDefaultStyle('default')
// or
// fWorksheet.setDefaultStyle({fs: 12, ff: 'Arial'});setFreeze
Sets the frozen state of the current sheet.
Deprecated
use setFrozenRows and setFrozenColumns instead.
Signature
setFreeze(freeze: IFreeze): FWorksheetParameters
freeze(IFreeze) — - the scrolling viewport start range and count of freezed rows and columns. that means if you want to freeze the first 3 rows and 2 columns, you should set freeze as { startRow: 3, startColumn: 2, xSplit: 2, ySplit: 3 }
Returns
- (
FWorksheet) — This worksheet instance for chaining
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Freeze first 3 rows and 2 columns
fWorksheet.setFreeze({
startRow: 3,
startColumn: 2,
xSplit: 2,
ySplit: 3,
})setFrozenColumns
Signature
setFrozenColumns(args?: [number] | [number, number]): FWorksheetsetFrozenRows
Signature
setFrozenRows(args?: [number] | [number, number]): FWorksheetsetGridLinesColor
Set the color of the gridlines in the sheet.
Signature
setGridLinesColor(color: string | undefined): FWorksheetParameters
color(string | undefined) — - The color to set for the gridlines.Undefined or null to reset to the default color.
Returns
- (
FWorksheet) — Returns the current worksheet instance for method chaining
Examples
const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet()
// set the gridlines color to red
fWorkSheet.setGridLinesColor('#ff0000')setHiddenGridlines
Hides or reveals the sheet gridlines.
Signature
setHiddenGridlines(hidden: boolean): FWorksheetParameters
hidden(boolean) — - Iftrue, hide gridlines in this sheet; otherwise show the gridlines.
Returns
- (
FWorksheet) — Returns the current worksheet instance for method chaining
Examples
const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet()
// hide the gridlines
fWorkSheet.setHiddenGridlines(true)setName
Sets the sheet name.
Signature
setName(name: string): FWorksheetParameters
name(string) — - The new name for the sheet.
Returns
- (
FWorksheet) — Returns the current worksheet instance for method chaining
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorkSheet = fWorkbook.getActiveSheet()
// set the sheet name to 'Sheet1'
fWorkSheet.setName('NewSheet1')setRangesAutoHeight
Sets the height of the given ranges to auto.
Signature
setRangesAutoHeight(ranges: IRange[]): FWorksheetParameters
ranges(IRange[]) — - The ranges to change
Returns
- (
FWorksheet) — This worksheet instance for chaining
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
const ranges = [
{ startRow: 1, endRow: 10, startColumn: 0, endColumn: 10 },
{ startRow: 11, endRow: 20, startColumn: 0, endColumn: 10 },
]
fWorksheet.setRangesAutoHeight(ranges)setRowAutoHeight
Sets the height of the given rows to auto.
Signature
setRowAutoHeight(startRow: number, numRows: number): FWorksheetParameters
startRow(number) — - The starting row position to changenumRows(number) — - The number of rows to change
Returns
- (
FWorksheet) — This worksheet instance for chaining
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
fWorksheet.setRowAutoHeight(1, 10)setRowCount
Sets the number of rows in the worksheet.
Signature
setRowCount(rowCount: number): FWorksheetParameters
rowCount(number) — - The number of rows to set.
Returns
- (
FWorksheet) — Returns the current worksheet instance for method chaining.
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorkSheet = fWorkbook.getActiveSheet()
// Set the number of rows in the worksheet to 40
fWorkSheet.setRowCount(40)setRowCustom
Set custom properties for given rows.
Signature
setRowCustom(custom: IObjectArrayPrimitiveType<CustomData>): FWorksheetParameters
custom(IObjectArrayPrimitiveType<CustomData>) — - The custom properties to set
Returns
- (
FWorksheet) — This worksheet instance for chaining
Examples
const fWorkSheet = univerAPI.getActiveWorkbook().getActiveSheet()
fWorkSheet.setRowCustom({ 0: { key: 'value' } })setRowCustomMetadata
Set custom metadata of row
Signature
setRowCustomMetadata(index: number, custom: CustomData | undefined): FWorksheetParameters
index(number) — - row indexcustom(CustomData | undefined) — - custom metadata
Returns
- (
FWorksheet) — Current worksheet, for chaining.
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorkSheet = fWorkbook.getActiveSheet()
fWorkSheet.setRowCustomMetadata(0, { key: 'value' })setRowDefaultStyle
Set the default style of the worksheet column
Signature
setRowDefaultStyle(index: number, style: string | Nullable<IStyleData>): FWorksheetParameters
index(number) — - The column indexstyle(string | Nullable<IStyleData>) — - The style name or style data
Returns
- (
FWorksheet) — This sheet, for chaining.
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorksheet = fWorkbook.getActiveSheet()
fWorksheet.setRowDefaultStyle(0, 'default')
// or
// fWorksheet.setRowDefaultStyle(0, {fs: 12, ff: 'Arial'});setRowHeight
Sets the row height of the given row in pixels. By default, rows grow to fit cell contents. If you want to force rows to a specified height, use setRowHeightsForced(startRow, numRows, height).
Signature
setRowHeight(rowPosition: number, height: number): FWorksheetParameters
rowPosition(number) — - The row position to change.height(number) — - The height in pixels to set it to.
Returns
- (
FWorksheet) — This worksheet instance for chaining
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Set the height of the second row to 30 pixels
fWorksheet.setRowHeight(1, 30)
// Set the height of the first row to 20 pixels
fWorksheet.setRowHeight(0, 20)setRowHeights
Sets the height of the given rows in pixels. By default, rows grow to fit cell contents. If you want to force rows to a specified height, use setRowHeightsForced(startRow, numRows, height).
Signature
setRowHeights(startRow: number, numRows: number, height: number): FWorksheetParameters
startRow(number) — - The starting row position to changenumRows(number) — - The number of rows to changeheight(number) — - The height in pixels to set it to
Returns
- (
FWorksheet) — This worksheet instance for chaining
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
fWorksheet.setRowHeights(1, 10, 30)setRowHeightsForced
Sets the height of the given rows in pixels. By default, rows grow to fit cell contents. When you use setRowHeightsForced, rows are forced to the specified height even if the cell contents are taller than the row height.
Signature
setRowHeightsForced(startRow: number, numRows: number, height: number): FWorksheetParameters
startRow(number) — - The starting row position to changenumRows(number) — - The number of rows to changeheight(number) — - The height in pixels to set it to
Returns
- (
FWorksheet) — This worksheet instance for chaining
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
fWorksheet.setRowHeightsForced(1, 10, 30)setTabColor
Sets the sheet tab color.
Signature
setTabColor(color: string): FWorksheetParameters
color(string) — - A color code in CSS notation (like '#ffffff' or 'white'), or null to reset the tab color.
Returns
- (
FWorksheet) — Returns the current worksheet instance for method chaining
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorkSheet = fWorkbook.getActiveSheet()
// set the tab color to red
fWorkSheet.setTabColor('#ff0000')showColumns
Show one or more consecutive columns starting at the given index. Use 0-index for this method
Signature
showColumns(columnIndex: number, numColumns?: number = 1): FWorksheetParameters
columnIndex(number) — - The starting index of the columns to unhidenumColumns(number) — - The number of columns to unhide
Returns
- (
FWorksheet) — This sheet, for chaining
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Unhide columns C, D, E
fWorksheet.showColumns(2, 3)
// Unhide column A
fWorksheet.showColumns(0, 1)showRows
Scrolling sheet to make specific rows visible.
Signature
showRows(rowIndex: number, numRows?: number = 1): FWorksheetParameters
rowIndex(number) — - The starting index of the rowsnumRows(number) — - The number of rows
Returns
- (
FWorksheet) — This worksheet instance for chaining
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Show 3 rows starting from row index 1 (rows 2-4)
fWorksheet.showRows(1, 3)
// Show single row at index 0 (first row)
fWorksheet.showRows(0)showSheet
Shows this sheet. Has no effect if the sheet is already visible.
Signature
showSheet(): FWorksheetReturns
- (
FWorksheet) — Returns the current worksheet instance for method chaining
Examples
const fWorkbook = univerAPI.getActiveWorkbook()
const fWorkSheets = fWorkbook.getSheets()
// show the last sheet
fWorkSheets[fWorkSheets.length - 1].showSheet()unhideColumn
Show the column in the given range.
Signature
unhideColumn(column: FRange): FWorksheetParameters
column(FRange) — - The range to unhide, if hidden
Returns
- (
FWorksheet) — This sheet, for chaining
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Unhide columns C, D, E
const column1 = fWorksheet.getRange('C:E')
fWorksheet.unhideColumn(column1)
// Unhide column A
const column2 = fWorksheet.getRange('A:A')
fWorksheet.unhideColumn(column2)unhideRow
Make the row in the given range visible.
Signature
unhideRow(row: FRange): FWorksheetParameters
row(FRange) — - The range to unhide, if hidden.
Returns
- (
FWorksheet) — This sheet, for chaining.
Examples
const fWorksheet = univerAPI.getActiveWorkbook().getActiveSheet()
// Unhide 3 rows starting from row index 1 (rows 2-4)
const row1 = fWorksheet.getRange('2:4')
fWorksheet.unhideRow(row1)
// Unhide single row at index 0 (first row)
const row2 = fWorksheet.getRange('1:1')
fWorksheet.unhideRow(row2)