HotXLS Docs

FreezePanes method

Freezes the left columns and top rows of a classic XLS worksheet, creates split panes, or removes pane settings from the worksheet

Syntax

function FreezePanes(ARow: Word; ACol: Word): Integer; overload;
function FreezePanes(Row: Word; Col: Word; RowTop: Word; ColLeft: Word): Integer; overload;
function UnfreezePanes: Integer;
function SplitPanes(Width: Single; Height: Single): Integer;
function UnsplitPanes: Integer;
function GetFrozenPanes(out AFreezeRow, AFreezeCol: Integer): Boolean;
ARow Word. Number of rows to freeze at the top of the worksheet
ACol Word. Number of columns to freeze on the left side of the worksheet
Row, Col, RowTop, ColLeft Word. Low-level BIFF pane values for callers that need explicit scroll positions
Width, Height Single. Split-pane dimensions using the same units as the existing thawed pane helper

Remarks

The two-parameter overload is the recommended entry point for common frozen pane layouts. Passing zero for both values removes frozen panes. GetFrozenPanes is the matching query: it returns True when frozen panes exist and reports the frozen row and column counts in the same units that FreezePanes accepts. Use SplitPanes to create a movable split instead of locked rows or columns. Use UnfreezePanes or UnsplitPanes when code should explicitly clear any existing pane record

Example

This example freezes the first column and the first two rows, then replaces the frozen pane with a split pane

var
  Workbook: IXLSWorkbook;
  Sheet: TXLSWorksheet;
begin
  Workbook := TXLSWorkbook.Create;
  Sheet := Workbook.Worksheets.Add;
  Sheet.FreezePanes(2, 1);
  Sheet.UnfreezePanes;
  Sheet.SplitPanes(4, 5);
  Workbook.SaveAs('freeze-panes.xls');
end;