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

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

Introduction

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

Prototype

void setRowGroupCollapsed(int row, boolean collapse);

Source Link

Document

Set view state of a grouped range of rows

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 .  j a  va  2s . com
    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);//from w ww  .  java 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);

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