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

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

Introduction

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

Prototype

int DEFAULT_WINDOW_SIZE

To view the source code for org.apache.poi.xssf.streaming SXSSFWorkbook DEFAULT_WINDOW_SIZE.

Click Source Link

Document

Specifies how many rows can be accessed at most via SXSSFSheet#getRow .

Usage

From source file:com.biomeris.i2b2.export.engine.ExcelCreator.java

License:Open Source License

public ExcelCreator(Integer rowAccessWindowSize) {
    if (rowAccessWindowSize != null && rowAccessWindowSize > 0) {
        this.rowAccessWindowSize = rowAccessWindowSize;
    } else {//from   w  ww.j  a  v  a 2  s . c o  m
        this.rowAccessWindowSize = SXSSFWorkbook.DEFAULT_WINDOW_SIZE;
    }
}

From source file:com.rapidminer.operator.io.ExcelExampleSetWriter.java

License:Open Source License

/**
 * Writes the example set into a excel file with XLSX format. If you want to write it in XLS
 * format use {@link #write(ExampleSet, Charset, OutputStream)}.
 *
 * @param exampleSet// w ww  . j  a  v a 2  s.c  om
 *            the exampleSet to write
 * @param sheetName
 *            name of the excel sheet which will be created.
 * @param dateFormat
 *            a string which describes the format used for dates.
 * @param numberFormat
 *            a string which describes the format used for numbers.
 * @param outputStream
 *            the stream to write the file to
 * @param op
 *            needed for checkForStop
 */
public static void writeXLSX(ExampleSet exampleSet, String sheetName, String dateFormat, String numberFormat,
        OutputStream outputStream, Operator op) throws WriteException, IOException, ProcessStoppedException {
    // .xlsx files can only store up to 16384 columns, so throw error in case of more
    if (exampleSet.getAttributes().allSize() > 16384) {
        throw new IllegalArgumentException(
                I18N.getMessage(I18N.getErrorBundle(), "export.excel.excel_xlsx_file_exceeds_column_limit"));
    }

    try (SXSSFWorkbook workbook = new SXSSFWorkbook(null, SXSSFWorkbook.DEFAULT_WINDOW_SIZE, false, true)) {
        Sheet sheet = workbook.createSheet(WorkbookUtil.createSafeSheetName(sheetName));

        dateFormat = dateFormat == null ? DEFAULT_DATE_FORMAT : dateFormat;

        numberFormat = numberFormat == null ? "#.0" : numberFormat;
        writeXLSXDataSheet(workbook, sheet, dateFormat, numberFormat, exampleSet, op);
        workbook.write(outputStream);
    } finally {
        outputStream.flush();
        outputStream.close();
    }
}