Version

Freezing and Splitting Panes (Infragistics Excel Engine)

Topic Overview

Purpose

This topic explains how to freeze columns and/or rows and how to split the worksheet in several panes.

Required background

The following topics are prerequisites to understanding this topic:

Topic Purpose

In this section you will find information that will help you to better understand the object model and the functionalities of the Infragistics Excel Engine.

In this topic

This topic contains the following sections:

Freezing and Splitting Configuration Summary

Freezing and splitting configuration summary chart

The following table explains briefly the configurable aspects of the freezing and splitting features. Further details are available after the table.

Configurable aspect Details Properties

This feature allows you to freeze rows and/or columns and make them visible at all time when the user is scrolling.

This feature allows you to split the worksheet into two or four scrollable panes.

Note
Note

You can also conveniently freeze and/or split panes using commands. For more information see the xamSpreadsheet’s Working with Commands (xamSpreadsheet) topic.

Freezing Panes

Overview

You can freeze row(s) at top or column(s) at left of a worksheet using the freezing panes features. Frozen row(s) and/or column(s) remain visible at all time while the user is scrolling. The frozen row(s) and/or column(s) are separate from the rest of the worksheet by a single solid line, which cannot be moved.

Note
Note

If you freeze rows and columns at the same time the horizontal scrollbar will still be able to scroll part of the frozen rows and the vertical scrollbar will still be able to scroll part of the frozen columns.

Property settings

The following table maps the desired configuration to the FrozenPaneSettings object’s properties that manage it.

In order to: Use this property: And set it to:

Enable panes freezing

true

Specify rows to freeze

A number of rows of your choice

Specify columns to freeze

A number of columns of your choice

Specify first row in the bottom pane

The first row (0-based index) number to be displayed in the bottom pane

Specify first column in the right pane

The first column (0-based index) number to be displayed in the right pane

Example

The following example code demonstrates how to freeze rows and columns. The example code assumes you have a reference to a worksheet object named worksheet1:

In Visual Basic:

worksheet1.DisplayOptions.PanesAreFrozen = True
' Freeze first row in worksheet
worksheet1.DisplayOptions.FrozenPaneSettings.FrozenRows = 1
' Freeze first 2 columns in worksheet
worksheet1.DisplayOptions.FrozenPaneSettings.FrozenColumns = 2
' The 4th column is displayed first after the frozen columns
worksheet1.DisplayOptions.FrozenPaneSettings.FirstColumnInRightPane = 4
' The 3rd row is displayed first after the frozen row
worksheet1.DisplayOptions.FrozenPaneSettings.FirstRowInBottomPane = 2

In C#:

worksheet1.DisplayOptions.PanesAreFrozen = true;
// Freeze first row in worksheet
worksheet1.DisplayOptions.FrozenPaneSettings.FrozenRows = 1;
// Freeze first 2 columns in worksheet
worksheet1.DisplayOptions.FrozenPaneSettings.FrozenColumns = 2;
// The 4th column is displayed first after the frozen columns
worksheet1.DisplayOptions.FrozenPaneSettings.FirstColumnInRightPane = 4;
// The 3rd row is displayed first after the frozen row
worksheet1.DisplayOptions.FrozenPaneSettings.FirstRowInBottomPane = 2;

Splitting Panes

Overview

You can use the splitting panes feature to split the worksheet into two (either horizontal or vertical) panes or four panes. Each pane supports scrolling, however panes on one column will share the same horizontal scrollbar and panes on one row will share the same vertical scrollbar. The split panes are separated by a double border which supports resizing.

Property settings

The following table maps the desired configuration to the UnfrozenPaneSettings object’s properties that manage it.

In order to: Use this property: And set it to:

Specify the first column in the left pane(s)

A column index of your choice (0-based)

Specify the first column in the right pane(s)

A column index of your choice (0-based)

Specify the first row in the top pane(s)

A row index of your choice (0-based)

Specify the first row in the bottom pane(s)

A row index of your choice (0-based)

Specify the left pane width

Note
Note

This will divide the worksheet vertically

A value of type int in twips (1/20th of a point)

Specify the top pane height

Note
Note

This will divide the worksheet horizontally

A value of type int in twips (1/20th of a point)

Example

The following example code demonstrates how to split rows and columns. The example code assumes you have a reference to a worksheet object named worksheet1:

In Visual Basic:

worksheet1.DisplayOptions.UnfrozenPaneSettings.FirstColumnInLeftPane = 0
worksheet1.DisplayOptions.UnfrozenPaneSettings.FirstColumnInRightPane = 5
worksheet1.DisplayOptions.UnfrozenPaneSettings.FirstRowInTopPane = 0
worksheet1.DisplayOptions.UnfrozenPaneSettings.FirstRowInBottomPane = 3
' left pane will be 150 points width
worksheet1.DisplayOptions.UnfrozenPaneSettings.LeftPaneWidth = 150 * 20
' top pane will be 100 points height
worksheet1.DisplayOptions.UnfrozenPaneSettings.TopPaneHeight = 100 * 20

In C#:

worksheet1.DisplayOptions.UnfrozenPaneSettings.FirstColumnInLeftPane = 0;
worksheet1.DisplayOptions.UnfrozenPaneSettings.FirstColumnInRightPane = 5;
worksheet1.DisplayOptions.UnfrozenPaneSettings.FirstRowInTopPane = 0;
worksheet1.DisplayOptions.UnfrozenPaneSettings.FirstRowInBottomPane = 3;
// left pane will be 150 points width
worksheet1.DisplayOptions.UnfrozenPaneSettings.LeftPaneWidth = 150 * 20;
// top pane will be 100 points height
worksheet1.DisplayOptions.UnfrozenPaneSettings.TopPaneHeight = 100 * 20;

Related Content

Topics

The following topics provide additional information related to this topic.

Topic Purpose

This topic explains how to show or hide the gridlines and set their color.

This topic explains how to show or hide the column and row headers.

This topic explains how to prevent the user from editing the cell values in a worksheet.

This topic explains how to programmatically set the zoom level in a worksheet.