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(Cols: Word; Rows: 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;
| Cols |
Word. Number of columns to freeze on the left side of the worksheet. |
| Rows |
Word. Number of rows to freeze at the top 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. 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: IXLSWorksheet;
begin
Workbook := TXLSWorkbook.Create;
Sheet := Workbook.Worksheets.Add;
Sheet.FreezePanes(1, 2);
Sheet.UnfreezePanes;
Sheet.SplitPanes(4, 5);
Workbook.SaveAs('freeze-panes.xls');
end;