Freeze

IWorksheetData.freeze can be used to configure the freeze state of a worksheet. Its interface definition is 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, if I want to freeze column B and row 2, I can configure it like this:

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}

Freeze panes

Scroll the grid in both directions and watch the frozen cells.

ABCDEFGH
1A1B1C1D1E1F1G1H1
2A2B2C2D2E2F2G2H2
3A3B3C3D3E3F3G3H3
4A4B4C4D4E4F4G4H4
5A5B5C5D5E5F5G5H5
6A6B6C6D6E6F6G6H6
7A7B7C7D7E7F7G7H7
8A8B8C8D8E8F8G8H8
9A9B9C9D9E9F9G9H9
10A10B10C10D10E10F10G10H10
11A11B11C11D11E11F11G11H11
12A12B12C12D12E12F12G12H12
13A13B13C13D13E13F13G13H13
14A14B14C14D14E14F14G14H14
15A15B15C15D15E15F15G15H15
16A16B16C16D16E16F16G16H16
17A17B17C17D17E17F17G17H17
18A18B18C18D18E18F18G18H18
{
  "startRow": 1,
  "startColumn": 1,
  "ySplit": 1,
  "xSplit": 1
}

The split is a count; the start is the first scrollable index (zero-based). Earlier rows and columns are outside this view.

Facade API

The FWorksheet class provides several methods to manage the freeze state of rows and columns in a worksheet. These methods allow you to set, get, and cancel frozen panes.

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.