Freeze Panes helps you to keep particular rows or columns visible when scrolling the sheet content in the spreadsheet. You can specify the number of frozen rows and columns using the frozenRows
and frozenColumns
properties inside the Sheet
property.
User Interface:
In the active spreadsheet, click the cell where you want to create freeze panes. Freeze panes can be done in any of the following ways:
Freeze Panes
item.freezePanes
method programmatically.It allows you to keep a certain number of rows visible while scrolling vertically through the rest of the worksheet.
User Interface:
In the active spreadsheet, select the cell where you want to create frozen rows. Frozen rows can be done in any one of the following ways:
Freeze Rows
item.frozenRows
property inside the Sheet
property.It allows you to keep a certain number of columns visible while scrolling horizontally through the rest of the worksheet.
User Interface:
In the active spreadsheet, select the cell where you want to create frozen columns. Frozen columns can be done in any one of the following ways:
Freeze Columns
item.frozenColumns
property inside the Sheet
property.In this demo, the frozenColumns is set as ‘2’, and the frozenRows is set as ‘2’. Hence, the two columns on the left and the top two rows are frozen.
import { Spreadsheet, SheetModel } from '@syncfusion/ej2-spreadsheet';
import { tradeData } from './datasource.ts';
import { enableRipple } from '@syncfusion/ej2-base';
enableRipple(true);
let columns: ColumnModel[] = [{ width: 100 }, { width: 130 },{ width: 96},
{ width: 130 }, { width: 130 },{ width: 96},
{ width: 100 }, { width: 100 },{ width: 110}, { width: 100 }, { width: 130 },{ width: 150}]
let spreadsheet: Spreadsheet = new Spreadsheet({
sheets: [{ ranges: [{ dataSource: tradeData }], columns: columns
// Specifies the number of frozen rows
frozenRows: 2,
// Specifies the number of frozen columns
frozenColumns: 2
}],
});
spreadsheet.appendTo('#spreadsheet');
<!DOCTYPE html>
<html lang="en">
<head>
<title>EJ2 SpreadSheet</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Typescript UI Controls" />
<meta name="author" content="Syncfusion" />
<link rel="shortcut icon" href="resources/favicon.ico" />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<link href="//cdn.syncfusion.com/ej2/ej2-base/styles/material.css" rel="stylesheet" />
<link href="//cdn.syncfusion.com/ej2/ej2-inputs/styles/material.css" rel="stylesheet" />
<link href="//cdn.syncfusion.com/ej2/ej2-buttons/styles/material.css" rel="stylesheet" />
<link href="//cdn.syncfusion.com/ej2/ej2-splitbuttons/styles/material.css" rel="stylesheet" />
<link href="//cdn.syncfusion.com/ej2/ej2-lists/styles/material.css" rel="stylesheet" />
<link href="//cdn.syncfusion.com/ej2/ej2-navigations/styles/material.css" rel="stylesheet" />
<link href="//cdn.syncfusion.com/ej2/ej2-popups/styles/material.css" rel="stylesheet" />
<link href="//cdn.syncfusion.com/ej2/ej2-dropdowns/styles/material.css" rel="stylesheet" />
<link href="//cdn.syncfusion.com/ej2/ej2-grids/styles/material.css" rel="stylesheet" />
<link href="//cdn.syncfusion.com/ej2/ej2-spreadsheet/styles/material.css" rel="stylesheet" />
<link href="styles.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="system.config.js"></script>
</head>
<body>
<!--Element which is going to render-->
<div id='loader'>Loading....</div>
<div id='container'>
<div id="spreadsheet"></div>
</div>
</body>
</html>
Freeze Panes feature is not compatible with all the features which are available in the spreadsheet and it has limited features support. Here, we have listed out the features which are not compatible with Freeze Panes feature.