FileDocCategorySizeDatePackage
SplitAndFreezePanes.javaAPI DocApache Poi 3.0.12198Mon Jan 01 12:39:42 GMT 2007org.apache.poi.hssf.usermodel.examples

SplitAndFreezePanes

public class SplitAndFreezePanes extends Object
author
Glen Stampoultzis (glens at apache.org)

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

        HSSFWorkbook wb = new HSSFWorkbook();
        HSSFSheet sheet1 = wb.createSheet("new sheet");
        HSSFSheet sheet2 = wb.createSheet("second sheet");
        HSSFSheet sheet3 = wb.createSheet("third sheet");
        HSSFSheet sheet4 = wb.createSheet("fourth sheet");

        // Freeze just one row
        sheet1.createFreezePane( 0, 1, 0, 1 );
        // Freeze just one column
        sheet2.createFreezePane( 1, 0, 1, 0 );
        // Freeze the columns and rows (forget about scrolling position of the lower right quadrant).
        sheet3.createFreezePane( 2, 2 );
        // Create a split with the lower left side being the active quadrant
        sheet4.createSplitPane( 2000, 2000, 0, 0, HSSFSheet.PANE_LOWER_LEFT );

        FileOutputStream fileOut = new FileOutputStream("workbook.xls");
        wb.write(fileOut);
        fileOut.close();