V4 V5

Leading rows and columns can be pinned so that scrolling does not move them.

Row 1 and column A frozen; the headers stay put while scrolling

Setting it

control.SetFreeze(rows: 1, cols: 0);   // freeze row 1
control.SetFreeze(1, 1);               // freeze row 1 and column A
control.SetFreeze(0, 0);               // unfreeze

The same API on all three controls (WinForms, WPF and Avalonia).

Working with the viewport directly, it is viewport.FrozenRows / viewport.FrozenCols.

using unvell.ReoGrid.Core;
using unvell.ReoGrid.Core.Rendering;

viewport.FrozenRows = 1;      // freeze row 1
viewport.FrozenCols = 1;      // freeze column A

// size of the frozen area in logical pixels; only the rest scrolls
double h = viewport.FrozenHeight;
double w = viewport.FrozenWidth;

double scrollableH = viewport.ScrollableContentHeight;
double scrollableW = viewport.ScrollableContentWidth;

A per-sheet display setting

V4 used worksheet.FreezeToCell(r, c) plus a FreezeArea enum. V5 keeps the number of frozen rows and columns in the sheet’s display settings, Worksheet.View (ws.View.FrozenRows / ws.View.FrozenCols).

  • A value set through a control’s SetFreeze is written back to ws.View, so it survives switching sheets
  • It is saved to reogrid-json and XLSX (5.1 and later). XLSX stores it as <pane state="frozen"> under <sheetViews>, so Excel opens the file frozen at the same place
  • Headless code can set it too (ws.View.FrozenRows = 1), and it is saved with the file
  • When one worksheet is shown through several controls, each keeps its own frozen position on screen; the file gets whichever value was changed last
  • Excel’s split (unfrozen) panes are not read

Relationship to scrolling

The frozen area is always drawn; only the scrollable part moves.

PropertyWhat it is
viewport.FrozenHeight / FrozenWidthThe frozen area’s size
viewport.ScrollableContentHeight / ScrollableContentWidthThe scrolling part’s size

Relationship to printing

Freezing is for the screen and has no effect on printing. To repeat the leading rows on every page, use print titles (PrintSettings.RepeatRows / RepeatColumns) instead (Printing and Page Setup).

Was this article helpful?