Excel Splits Pane Feature

In this section, you will learn how to split the excel sheet using Apache POI.

Excel Splits Pane Feature

In this section, you will learn how to split the excel sheet using Apache POI.

Sometimes, you need to view more than one copy of the sheet. This can be done using Excel Splits Pane Feature. Using this feature you can view the sheet into 4 split area.

The syntax is given below :

sheet1.createSplitPane( 2000, 2000, 0, 0, Sheet.PANE_LOWER_LEFT );

The first parameter is the x position of the split. The second parameter is the y position of the split. The last parameter indicates which pane currently has the focus.

The given below example divide the viewing area of sheet into four areas :

import java.io.FileOutputStream;
import java.io.IOException;

import org.apache.poi.ss.usermodel.CreationHelper;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

public class XmlSplitPane {
public static void main(String args[]) throws IOException {
Workbook wb = new XSSFWorkbook();
CreationHelper createHelper = wb.getCreationHelper();
Sheet sheet1 = wb.createSheet("new sheet");

Row row = sheet1.createRow((short) 0);
// Create a cell and put a value in it.
createHelper.createRichTextString("THIS IS FREEZED ROW"));
for (int i = 1; i < 20; i++) {
row = sheet1.createRow((short) i);
.createRichTextString("This is the Moving Row"));

sheet1.createSplitPane(2000, 2000, 0, 0, Sheet.PANE_LOWER_LEFT);

FileOutputStream fileOut = new FileOutputStream(


The output is given below :

Download Source Code

Share on Google+Share on Google+

Excel Splits Pane Feature

Posted on: August 10, 2011 If you enjoyed this post then why not add us on Google+? Add us to your Circles



Discuss: Excel Splits Pane Feature  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image