Freeze

IWorksheetData.freeze holds the freeze state of a worksheet. The interface is defined as follows:

TypeScript
interface IFreeze {  /**   * The number of frozen columns   */  xSplit: number  /**   * The number of frozen rows   */  ySplit: number  /**   * The starting row that can be scrolled (the starting row of the main view area)   */  startRow: number  /**   * The starting column that can be scrolled (the starting column of the main view area)   */  startColumn: number}

For example, the following configuration freezes column B and row 2:

JSON
{  "xSplit": 1, // Freeze 1 column, which is column B  "ySplit": 1, // Freeze 1 row, which is row 2  "startRow": 2, // The starting row that can be scrolled is row 3  "startColumn": 2 // The starting column that can be scrolled is column C}

Facade API

The FWorksheet class provides several methods for managing frozen rows and columns. These methods set a frozen pane, read the current freeze state, or cancel the freeze.

Set freeze

TypeScript
const worksheet = univerAPI.getActiveWorkbook().getActiveSheet()worksheet.setFreeze({  xSplit: 1, // Freeze 1 column, which is column B  ySplit: 1, // Freeze 1 row, which is row 2  startRow: 2, // The starting row that can be scrolled is row 3  startColumn: 2, // The starting column that can be scrolled is column C})console.log('The current freeze state:', worksheet.getFreeze())

Set frozen columns

TypeScript
const worksheet = univerAPI.getActiveWorkbook().getActiveSheet()// Set freeze for columns A-Bworksheet.setFrozenColumns(2)

Set frozen rows

TypeScript
const worksheet = univerAPI.getActiveWorkbook().getActiveSheet()// Set freeze for the first 3 rowsworksheet.setFrozenRows(3)

Get freeze state

TypeScript
const worksheet = univerAPI.getActiveWorkbook().getActiveSheet()const freezeState = worksheet.getFreeze()

Get frozen columns

TypeScript
const worksheet = univerAPI.getActiveWorkbook().getActiveSheet()const frozenColumns = worksheet.getFrozenColumns()

Get frozen rows

TypeScript
const worksheet = univerAPI.getActiveWorkbook().getActiveSheet()const frozenRows = worksheet.getFrozenRows()

Cancel freeze

TypeScript
const worksheet = univerAPI.getActiveWorkbook().getActiveSheet()// Cancel all freezesworksheet.cancelFreeze()

How is this guide?

© 2026 DreamNum Co., Ltd.