Example usage for org.apache.poi.ss.usermodel Sheet groupColumn

List of usage examples for org.apache.poi.ss.usermodel Sheet groupColumn

Introduction

In this page you can find the example usage for org.apache.poi.ss.usermodel Sheet groupColumn.

Prototype

void groupColumn(int fromColumn, int toColumn);

Source Link

Document

Create an outline for the provided column range.

Usage

From source file:packtest.Outlining.java

License:Apache License

private void groupRowColumn() throws Exception {
    Workbook wb = new XSSFWorkbook();
    Sheet sheet1 = wb.createSheet("new sheet");

    sheet1.groupRow(5, 14);//from   w w w  .ja v a 2 s  . c o m
    sheet1.groupRow(7, 14);
    sheet1.groupRow(16, 19);

    sheet1.groupColumn((short) 4, (short) 7);
    sheet1.groupColumn((short) 9, (short) 12);
    sheet1.groupColumn((short) 10, (short) 11);

    OutputStream fileOut = new FileOutputStream("outlining.xlsx");
    try {
        wb.write(fileOut);
    } finally {
        fileOut.close();
    }
}

From source file:packtest.Outlining.java

License:Apache License

private void collapseExpandRowColumn() throws Exception {
    Workbook wb2 = new XSSFWorkbook();
    Sheet sheet2 = wb2.createSheet("new sheet");
    sheet2.groupRow(5, 14);//from   w  w w . j  av a 2s.  co  m
    sheet2.groupRow(7, 14);
    sheet2.groupRow(16, 19);

    sheet2.groupColumn((short) 4, (short) 7);
    sheet2.groupColumn((short) 9, (short) 12);
    sheet2.groupColumn((short) 10, (short) 11);

    sheet2.setRowGroupCollapsed(7, true);
    //sheet1.setRowGroupCollapsed(7,false);

    sheet2.setColumnGroupCollapsed((short) 4, true);
    sheet2.setColumnGroupCollapsed((short) 4, false);

    OutputStream fileOut = new FileOutputStream("outlining_collapsed.xlsx");
    try {
        wb2.write(fileOut);
    } finally {
        fileOut.close();
    }
}

From source file:poi.xssf.usermodel.examples.Outlining.java

License:Apache License

private void groupRowColumn() throws Exception {
    Workbook wb = new XSSFWorkbook();
    Sheet sheet1 = wb.createSheet("new sheet");

    sheet1.groupRow(5, 14);/*from   w w  w  .  j  a  v a 2 s. c o m*/
    sheet1.groupRow(7, 14);
    sheet1.groupRow(16, 19);

    sheet1.groupColumn((short) 4, (short) 7);
    sheet1.groupColumn((short) 9, (short) 12);
    sheet1.groupColumn((short) 10, (short) 11);

    FileOutputStream fileOut = new FileOutputStream("outlining.xlsx");
    wb.write(fileOut);
    fileOut.close();

}

From source file:poi.xssf.usermodel.examples.Outlining.java

License:Apache License

private void collapseExpandRowColumn() throws Exception {
    Workbook wb2 = new XSSFWorkbook();
    Sheet sheet2 = wb2.createSheet("new sheet");
    sheet2.groupRow(5, 14);/*from w ww. ja  v a 2 s  .c  om*/
    sheet2.groupRow(7, 14);
    sheet2.groupRow(16, 19);

    sheet2.groupColumn((short) 4, (short) 7);
    sheet2.groupColumn((short) 9, (short) 12);
    sheet2.groupColumn((short) 10, (short) 11);

    sheet2.setRowGroupCollapsed(7, true);
    //sheet1.setRowGroupCollapsed(7,false);

    sheet2.setColumnGroupCollapsed((short) 4, true);
    sheet2.setColumnGroupCollapsed((short) 4, false);

    FileOutputStream fileOut = new FileOutputStream("outlining_collapsed.xlsx");
    wb2.write(fileOut);
    fileOut.close();
}