Freeze or Split Panes

Following example demonstrates how to 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.

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

class Program {

    public static void main(String[] args) throws java.io.IOException {
        // If using Professional version, put your serial key below.
        SpreadsheetInfo.setLicense("FREE-LIMITED-KEY");

        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));

        workbook.save("Freeze or Split Panes.%OutputFileType%");
    }
}

Check next example or download examples from GitHub.