Example usage for org.apache.poi.xssf.streaming SXSSFWorkbook getXSSFWorkbook

List of usage examples for org.apache.poi.xssf.streaming SXSSFWorkbook getXSSFWorkbook

Introduction

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

Prototype

public XSSFWorkbook getXSSFWorkbook() 

Source Link

Usage

From source file:org.apache.tika.eval.reports.Report.java

License:Apache License

private void dumpXLSX(Connection c, Path reportsRoot) throws IOException, SQLException {
    Statement st = c.createStatement();
    Path out = reportsRoot.resolve(reportFilename);
    Files.createDirectories(out.getParent());

    SXSSFWorkbook wb = new SXSSFWorkbook(new XSSFWorkbook(), 100, true, true);
    wb.setCompressTempFiles(true);//from  w  w w . ja  va  2  s  . com
    defaultIntegerFormatter.reset(wb.getXSSFWorkbook());
    defaultDoubleFormatter.reset(wb.getXSSFWorkbook());
    sqlCellStyle = wb.createCellStyle();
    sqlCellStyle.setVerticalAlignment(VerticalAlignment.TOP);
    sqlCellStyle.setWrapText(true);

    try {
        dumpReportToWorkbook(st, wb);
    } finally {
        try (OutputStream os = Files.newOutputStream(out)) {
            wb.write(os);
        } finally {
            wb.dispose();
        }
    }
}