Freeze and Split Panes

The following example shows how you can create worksheet panes. Panes can be frozen, split and frozen/split.

Note that some values of PanePosition enumeration are invalid if the pane doesn't exist in the split.

Excel frozen and split panes set with GemBox.Spreadsheet for Java
Screenshot of Excel frozen and split panes set with GemBox.Spreadsheet for Java
import com.gembox.spreadsheet.*;

class Program {

    public static void main(String[] args) throws {
        // If using the Professional version, put your serial key below.

        ExcelFile workbook = new ExcelFile();

        // Frozen Rows (first 2 rows are frozen)
        ExcelWorksheet worksheet1 = workbook.addWorksheet("Frozen rows");
        worksheet1.setPanes(new WorksheetPanes(PanesState.FROZEN, 0, 2, "A3", PanePosition.BOTTOM_LEFT));

        // Frozen Columns (first column is frozen)
        ExcelWorksheet worksheet2 = workbook.addWorksheet("Frozen columns");
        worksheet2.setPanes(new WorksheetPanes(PanesState.FROZEN, 1, 0, "B1", PanePosition.TOP_RIGHT));

        // Frozen Rows and Columns (first 2 rows and first 3 columns are frozen)
        ExcelWorksheet worksheet3 = workbook.addWorksheet("Frozen rows and columns");
        worksheet3.setPanes(new WorksheetPanes(PanesState.FROZEN, 3, 2, "E5", PanePosition.BOTTOM_RIGHT));

        // Split pane
        ExcelWorksheet worksheet4 = workbook.addWorksheet("Split pane");
        worksheet4.setPanes(new WorksheetPanes(PanesState.SPLIT, 2310, 1500, "D7", PanePosition.BOTTOM_RIGHT));"Freeze or Split Panes.%OutputFileType%");

See also

Next steps

GemBox.Spreadsheet for Java is a component that enables you to read, write, edit and convert spreadsheet files from your applications using one simple API.

Download Buy