Example usage for org.apache.poi.xssf.streaming SXSSFSheet groupRow

List of usage examples for org.apache.poi.xssf.streaming SXSSFSheet groupRow

Introduction

In this page you can find the example usage for org.apache.poi.xssf.streaming SXSSFSheet groupRow.

Prototype

@Override
public void groupRow(int fromRow, int toRow) 

Source Link

Document

Tie a range of rows together so that they can be collapsed or expanded

Please note the rows being grouped must be in the current window, if the rows are already flushed then groupRow has no effect.

Usage

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

License:Apache License

private void collapseRow() throws Exception {
    SXSSFWorkbook wb2 = new SXSSFWorkbook(100);
    SXSSFSheet sheet2 = (SXSSFSheet) wb2.createSheet("new sheet");

    int rowCount = 20;
    for (int i = 0; i < rowCount; i++) {
        sheet2.createRow(i);// w ww.j a va  2 s.  c  o  m
    }

    sheet2.groupRow(4, 9);
    sheet2.groupRow(11, 19);

    sheet2.setRowGroupCollapsed(4, true);

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