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

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

Introduction

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

Prototype

void setColumnGroupCollapsed(int columnNumber, boolean collapsed);

Source Link

Document

Expands or collapses a column group.

Usage

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);//w w w . ja va  2 s  . 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 collapseExpandRowColumn() throws Exception {
    Workbook wb2 = new XSSFWorkbook();
    Sheet sheet2 = wb2.createSheet("new sheet");
    sheet2.groupRow(5, 14);// ww w . ja v a 2  s .c  o  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);

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