Example usage for org.apache.poi.hssf.usermodel HSSFWorkbook HSSFWorkbook

List of usage examples for org.apache.poi.hssf.usermodel HSSFWorkbook HSSFWorkbook

Introduction

In this page you can find the example usage for org.apache.poi.hssf.usermodel HSSFWorkbook HSSFWorkbook.

Prototype

public HSSFWorkbook() 

Source Link

Document

Creates new HSSFWorkbook from scratch (start here!)

Usage

From source file:com.eryansky.core.excelTools.JsGridReportBase.java

License:Apache License

/**
 * Excel()/*  w ww  .j  a  va  2 s.  c  o m*/
 * 
 * @param title
 *            ??
 * @param creator
 *            
 * @param tableDataLst
 *            ??(??tableData?sheet???)
 * @return void <style name="dataset"> case SYSROWNUM%2==0?#row0:#row1;
 *         fontsize:9px; </style> <style name="row0"> import(parent);
 *         bgcolor:#FFFFFF; </style> <style name="row1"> import(parent);
 *         bgcolor:#CAEAFE; </style>
 */
public void exportToExcel(String title, String creator, List<TableData> tableDataLst) throws Exception {

    HSSFWorkbook wb = new HSSFWorkbook();// Excel 
    HashMap<String, HSSFCellStyle> styles = initStyles(wb);// ??

    int i = 1;
    for (TableData tableData : tableDataLst) {
        String sheetTitle = tableData.getSheetTitle();
        sheetTitle = sheetTitle == null || sheetTitle.equals("") ? "sheet" + i : sheetTitle;
        wb = writeSheet(wb, tableData.getSheetTitle(), styles, creator, tableData);//
        i++;
    }

    String sFileName = title + ".xls";
    WebUtils.setDownloadableHeader(request, response, sFileName);
    response.setHeader("Connection", "close");
    response.setHeader("Content-Type", "application/vnd.ms-excel");

    wb.write(response.getOutputStream());
}

From source file:com.esd.cs.common.PoiCreateExcel.java

License:Open Source License

/**
 * ?/*  ww  w.  ja  va2 s  .  co  m*/
 * 
 * @param FilePath
 * @param workerList
 * @return
 */
public static boolean createExcel(String FilePath, List<WorkerTemp> workerList) {
    // Excel Workbook,excel
    HSSFWorkbook wb = new HSSFWorkbook();
    // Excelsheet,exceltab
    HSSFSheet sheet = wb.createSheet("sheet1");
    // excel?
    sheet.setColumnWidth(0, 4000);
    sheet.setColumnWidth(1, 3500);

    // Excel?
    HSSFRow headRow = sheet.createRow(0);
    HSSFCell headell = headRow.createCell(0);
    // ???
    headell = headRow.createCell(0);
    headell.setCellValue("??");
    headell = headRow.createCell(1);
    headell.setCellValue("??");
    sheet.setColumnWidth(1, 8000);
    headell = headRow.createCell(2);
    headell.setCellValue("");
    sheet.setColumnWidth(2, 13000);

    for (int i = 1; i <= workerList.size(); i++) {
        WorkerTemp worker = workerList.get(i - 1);
        // Excel?
        HSSFRow row = sheet.createRow(i);
        HSSFCell cell = row.createCell(0);
        // ???
        cell = row.createCell(0);
        cell.setCellValue(worker.getWorkerName());
        cell = row.createCell(1);
        cell.setCellValue(worker.getWorkerHandicapCode());
        cell = row.createCell(2);
        cell.setCellValue(worker.getRemark());
    }
    try {
        FileOutputStream os = new FileOutputStream(FilePath);
        wb.write(os);
        os.close();

    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    return true;
}

From source file:com.esd.cs.common.PoiCreateExcel.java

License:Open Source License

/**
 * ???/*from   w  w w . j  a  v a  2 s  .  co m*/
 * 
 * @param FilePath
 * @param companyList
 * @return
 */
public static boolean createComapnyExcel(String FilePath, List<Company> companyList) {
    // Excel Workbook,excel
    HSSFWorkbook wb = new HSSFWorkbook();
    // Excelsheet,exceltab
    HSSFSheet sheet = wb.createSheet("sheet1");
    // excel?
    sheet.setColumnWidth(0, 4000);
    sheet.setColumnWidth(1, 3500);

    // Excel?
    HSSFRow headRow = sheet.createRow(0);
    HSSFCell headell = headRow.createCell(0);
    // ???
    headell = headRow.createCell(0);
    headell.setCellValue("?");
    headell = headRow.createCell(1);
    headell.setCellValue("?");
    headell = headRow.createCell(2);
    headell.setCellValue("????");
    sheet.setColumnWidth(2, 12000); // 

    headell = headRow.createCell(3);
    headell.setCellValue("");
    headell = headRow.createCell(4);
    headell.setCellValue("?");

    headell = headRow.createCell(5);
    headell.setCellValue("???");

    headell = headRow.createCell(6);
    headell.setCellValue("??");

    headell = headRow.createCell(7);
    headell.setCellValue("");
    headell = headRow.createCell(8);
    headell.setCellValue("???");
    sheet.setColumnWidth(8, 12000);

    for (int i = 1; i <= companyList.size(); i++) {
        Company company = companyList.get(i - 1);
        // Excel?
        HSSFRow row = sheet.createRow(i);
        HSSFCell cell = row.createCell(0);
        // ???
        // ?
        cell = row.createCell(0);
        cell.setCellValue(company.getCompanyCode());
        // ?
        cell = row.createCell(1);
        cell.setCellValue(company.getCompanyTaxCode());
        // ???
        cell = row.createCell(2);
        cell.setCellValue(company.getCompanyName());
        // 
        cell = row.createCell(3);
        cell.setCellValue(company.getCompanyLegal());
        // ?
        cell = row.createCell(4);
        cell.setCellValue(company.getCompanyContactPerson());
        // ???
        cell = row.createCell(5);
        cell.setCellValue(company.getCompanyPhone());
        // ??
        cell = row.createCell(6);
        cell.setCellValue(company.getCompanyMobile());
        // 
        cell = row.createCell(7);
        cell.setCellValue(company.getCompanyZipCode());
        // ???
        cell = row.createCell(8);
        cell.setCellValue(company.getCompanyAddress());
    }
    try {
        FileOutputStream os = new FileOutputStream(FilePath);
        wb.write(os);
        os.flush();
        os.close();
        companyList.clear();
        companyList = null;
        os = null;
        wb = null;
        System.gc();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    return true;
}

From source file:com.esd.cs.common.PoiCreateExcel.java

License:Open Source License

/**
 * /*from  ww w. ja  v a 2 s  .c  om*/
 * 
 * @param FilePath
 * @param companyList
 * @return
 */
public static boolean createRepeaExcel(String FilePath, List<ReportViewModel> companyList, ReportModel model) {
    // Excel Workbook,excel
    HSSFWorkbook wb = new HSSFWorkbook();
    // Excelsheet,exceltab
    HSSFSheet sheet = wb.createSheet("sheet1");
    // excel?
    sheet.setColumnWidth(0, 4000);
    sheet.setColumnWidth(1, 3500);

    // Excel?
    HSSFRow headRow0 = sheet.createRow(0);
    HSSFCell headCell = headRow0.createCell(0);
    // ??
    sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 13));// ???
    headCell = headRow0.createCell(0);
    // 
    headCell.setCellValue(model.getTitle());
    // ?
    HSSFCellStyle style = wb.createCellStyle();
    style.setFillBackgroundColor(HSSFColor.GREEN.index);
    style.setAlignment(CellStyle.ALIGN_CENTER);// 
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);// 
    // 
    HSSFFont font = wb.createFont();
    font.setFontHeightInPoints((short) 12);
    font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); // 
    style.setFont(font);
    headCell.setCellStyle(style);

    // ? ??
    HSSFRow RowTow = sheet.createRow(1);
    HSSFCell CellTow = headRow0.createCell(1);
    // ??
    sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 5));// ???
    CellTow = RowTow.createCell(0);
    // 
    CellTow.setCellValue(model.getCreateCompany());

    // ? 
    // ??
    sheet.addMergedRegion(new CellRangeAddress(1, 1, 6, 13));// ???
    CellTow = RowTow.createCell(6);
    HSSFCellStyle style1 = wb.createCellStyle();
    style1.setFillBackgroundColor(HSSFColor.GREEN.index);
    style1.setAlignment(CellStyle.ALIGN_RIGHT);// ?
    CellTow.setCellStyle(style1);
    // 
    CellTow.setCellValue(model.getCreateData());

    // ?
    HSSFRow headRow = sheet.createRow(2);
    HSSFCell headell = headRow.createCell(2);
    // ???
    headell = headRow.createCell(0);
    headell.setCellValue(model.getType());

    headell = headRow.createCell(1);
    headell.setCellValue("??");

    headell = headRow.createCell(2);
    headell.setCellValue("??");
    sheet.setColumnWidth(2, 3000); // 

    headell = headRow.createCell(3);
    headell.setCellValue("???");
    sheet.setColumnWidth(3, 3000); // 

    headell = headRow.createCell(4);
    headell.setCellValue("???");
    sheet.setColumnWidth(4, 4000); // 

    headell = headRow.createCell(5);
    headell.setCellValue("???");
    sheet.setColumnWidth(5, 4000); // 

    headell = headRow.createCell(6);
    headell.setCellValue("???");
    sheet.setColumnWidth(6, 4500); // 

    headell = headRow.createCell(7);
    headell.setCellValue("");
    sheet.setColumnWidth(8, 4000);

    headell = headRow.createCell(8);
    headell.setCellValue("");
    sheet.setColumnWidth(8, 4000);

    headell = headRow.createCell(9);
    headell.setCellValue("");
    sheet.setColumnWidth(9, 4000);

    headell = headRow.createCell(10);
    headell.setCellValue("?");
    sheet.setColumnWidth(10, 4000);

    headell = headRow.createCell(11);
    headell.setCellValue("???");

    headell = headRow.createCell(12);
    headell.setCellValue("?");

    headell = headRow.createCell(13);
    headell.setCellValue("?");

    for (int i = 0; i < companyList.size(); i++) {
        ReportViewModel company = companyList.get(i);
        // Excel?
        HSSFRow row = sheet.createRow(i + 3);
        HSSFCell cell = row.createCell(i + 3);
        // ???
        // ????
        cell = row.createCell(0);
        cell.setCellValue(company.getReportName());
        // ??
        cell = row.createCell(1);
        cell.setCellValue(company.getUnitNum());
        // ??
        cell = row.createCell(2);
        cell.setCellValue(company.getEmpTotal());

        // ???
        cell = row.createCell(3);
        cell.setCellValue(company.getUnAudit());

        // ?, ???
        cell = row.createCell(4);
        cell.setCellValue(company.getUnReAudit());

        // ?, ??
        cell = row.createCell(5);
        cell.setCellValue(company.getAuditOk());

        // ?, ??
        cell = row.createCell(6);
        cell.setCellValue(company.getUnauditOk());

        // 
        cell = row.createCell(7);
        cell.setCellValue(company.getShouldTotal().toString());

        // ?
        cell = row.createCell(8);
        cell.setCellValue(company.getAlreadyTotal().toString());

        // 
        cell = row.createCell(9);
        cell.setCellValue(company.getLessTotal().toString());
        // ?
        cell = row.createCell(10);
        cell.setCellValue(company.getAmountPayable().toString());
        // ???
        cell = row.createCell(11);
        cell.setCellValue(company.getReductionAmount().toString());
        // ?
        cell = row.createCell(12);
        cell.setCellValue(company.getActualAmount().toString());
        // ?
        cell = row.createCell(13);
        cell.setCellValue(company.getAlreadyAmount().toString());
    }

    // ? 
    HSSFRow row = sheet.createRow(companyList.size() + 3);
    HSSFCell cell = row.createCell(companyList.size() + 3);
    // ???
    // ????
    sheet.addMergedRegion(new CellRangeAddress(companyList.size() + 3, companyList.size() + 3, 0, 13));// ???
    cell = row.createCell(0);
    // ?
    HSSFCellStyle styleFoot = wb.createCellStyle();
    styleFoot.setAlignment(CellStyle.ALIGN_RIGHT);// ?
    cell.setCellStyle(styleFoot);
    // 
    cell.setCellValue(model.getCreatePeople());

    try {
        FileOutputStream os = new FileOutputStream(FilePath);
        wb.write(os);
        os.flush();
        os.close();
        companyList.clear();
        companyList = null;
        os = null;
        wb = null;
        System.gc();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    return true;
}

From source file:com.esd.ps.excel.PoiCreateExcel.java

License:Open Source License

/**
 * ?/*from ww  w  .  j a va2 s .  c o m*/
 * 
 * @param FilePath
 * @param companyList
 * @return
 */
public static boolean createRegistrationExcel(String FilePath, List<Registration> list) {
    // Excel Workbook,excel
    HSSFWorkbook wb = new HSSFWorkbook();
    // Excelsheet,exceltab
    HSSFSheet sheet = wb.createSheet("sheet1");
    // excel?
    sheet.setColumnWidth(0, 4000);
    sheet.setColumnWidth(1, 3500);

    // Excel?
    HSSFRow headRow = sheet.createRow(0);
    HSSFCell headell = headRow.createCell(0);
    // ???
    headell = headRow.createCell(0);
    headell.setCellValue("??");
    headell = headRow.createCell(1);
    headell.setCellValue("??");
    headell = headRow.createCell(2);
    headell.setCellValue("??");
    // sheet.setColumnWidth(2, 12000); // 

    headell = headRow.createCell(3);
    headell.setCellValue("QQ");
    headell = headRow.createCell(4);
    headell.setCellValue("??");

    headell = headRow.createCell(5);
    headell.setCellValue("??");
    SimpleDateFormat sdf = new SimpleDateFormat(Constants.DATETIME_FORMAT);
    for (int i = 1; i <= list.size(); i++) {
        Registration r = list.get(i - 1);
        // Excel?
        HSSFRow row = sheet.createRow(i);
        HSSFCell cell = row.createCell(0);
        // ???
        // ??
        cell = row.createCell(0);
        cell.setCellValue(r.getName());
        // ??
        cell = row.createCell(1);
        cell.setCellValue(r.getCard());
        // ?
        cell = row.createCell(2);
        cell.setCellValue(r.getPhone());
        // QQ
        cell = row.createCell(3);
        cell.setCellValue(r.getQq());
        // ??
        cell = row.createCell(4);
        cell.setCellValue(r.getAddress());
        // ??
        cell = row.createCell(5);
        cell.setCellValue(sdf.format(r.getCreateTime()));
    }
    try {
        FileOutputStream os = new FileOutputStream(FilePath);
        wb.write(os);
        os.flush();
        os.close();
        list.clear();
        list = null;
        os = null;
        wb = null;
        System.gc();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    return true;
}

From source file:com.eurodyn.qlack2.fuse.lexicon.impl.LanguageServiceImpl.java

License:EUPL

@Override
@Transactional(TxType.REQUIRED)/*from  w w w  . j  av  a  2  s  . com*/
public byte[] downloadLanguage(String languageID) {
    byte[] retVal = null;

    // Check that the language exists and get its translations
    Language language = Language.find(languageID, em);

    // Create an Excel workbook. The workbook will contain a sheet for each
    // group.
    Workbook wb = new HSSFWorkbook();
    CreationHelper createHelper = wb.getCreationHelper();

    // Iterate over all existing groups and create a sheet for each one.
    // Creating a new list below and not using the one retrieved from
    // Group.getAllGroups since result lists are read only and
    // we need to add the empty group below to the list.
    List<Group> groups = new ArrayList<>(Group.getAllGroups(em));
    // Add an dummy entry to the list to also check for translations without
    // a group.
    Group emptyGroup = new Group();
    emptyGroup.setId(null);
    emptyGroup.setTitle("<No group>");
    groups.add(0, emptyGroup);
    for (Group group : groups) {
        Map<String, String> translations;
        translations = keyService.getTranslationsForGroupAndLocale(group.getId(), language.getLocale());
        if (!translations.isEmpty()) {
            Sheet sheet = wb.createSheet(group.getTitle());

            // Add the header.
            Row headerRow = sheet.createRow(0);
            headerRow.createCell(0).setCellValue(createHelper.createRichTextString("Key"));
            headerRow.createCell(1).setCellValue(createHelper.createRichTextString("Translation"));

            // Add the data.
            int rowCounter = 1;
            for (String key : translations.keySet()) {
                Row row = sheet.createRow(rowCounter++);
                row.createCell(0).setCellValue(createHelper.createRichTextString(key));
                row.createCell(1).setCellValue(createHelper.createRichTextString(translations.get(key)));
            }
        }
    }

    // Create the byte[] holding the Excel data.
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    try {
        wb.write(bos);
        retVal = bos.toByteArray();
    } catch (IOException ex) {
        // Convert to a runtime exception in order to roll back transaction
        LOGGER.log(Level.SEVERE, ex.getLocalizedMessage(), ex);
        throw new QLanguageProcessingException("Error creating Excel file for language " + languageID);
    }

    return retVal;
}

From source file:com.evidon.areweprivateyet.Aggregator.java

License:Open Source License

public void createSpreadSheet() throws Exception {
    int row = 2, cell = 0, sheet = 0;
    FileOutputStream file = new FileOutputStream(path + "analysis.xls");

    Workbook wb = new HSSFWorkbook();

    // content: total content length sheet.
    Sheet s = wb.createSheet();//from   w  w w. j a  v  a  2 s.  co m
    wb.setSheetName(sheet, "Content Length");
    this.createHeader(wb, s, "Total Content Length in MB", 0);

    Row r = s.createRow(row);
    for (String database : results.keySet()) {
        Cell c = r.createCell(cell);
        c.setCellValue(results.get(database).totalContentLength / 1024 / 1024);
        cell++;
    }

    row++;
    cell = 0;
    r = s.createRow(row);

    for (String database : results.keySet()) {
        Cell c = r.createCell(cell);
        if (database.equals("baseline")) {
            c.setCellValue("Decrease:");

            Map<String, String> contents = new LinkedHashMap<String, String>();
            contents.put(s.getSheetName(), "0");
            decrease.put(database, contents);
        } else {
            c = r.createCell(cell);
            c.setCellType(Cell.CELL_TYPE_FORMULA);
            c.setCellFormula("ROUND((100-(" + getCellLetter(cell - 1) + "3*100/A3)),0)");

            FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator();
            evaluator.evaluateFormulaCell(c);

            Map<String, String> contents = new LinkedHashMap<String, String>();
            contents.put(s.getSheetName(), c.getNumericCellValue() + "");
            decrease.put(database, contents);
        }
        cell++;
    }
    sheet++;

    // When content is created, baseline is used as a base for every entry. For example,
    // if baseline contained doubleclick.com, this will be output and each other analyzer's
    // map, like ghosterys analyzer is then asked for the content's mapping for doubleclick.
    // So, if baseline does not contain blah.com, yet ghostery map does, this entry is never
    // shown in the spreadsheet or any other results.

    // so this means if we have tracker/whatever URLs in a non-baseline profile
    // and these URLs are NOT in the baseline profile,
    // we wouldn't see those trackers/whatever in the final comparison.

    // content: HTTP Requests
    s = wb.createSheet();
    wb.setSheetName(sheet, "HTTP Requests");
    this.createHeader(wb, s, "Pages with One or More HTTP Requests to the Public Suffix", 1);
    this.createContent(wb, s, "requestCountPerDomain");
    sheet++;

    // content: HTTP Set-Cookie Responses
    s = wb.createSheet();
    wb.setSheetName(sheet, "HTTP Set-Cookie Responses");
    this.createHeader(wb, s,
            "Pages with One or More HTTP Responses from the Public Suffix That Include a Set-Cookie Header", 1);
    this.createContent(wb, s, "setCookieResponses");
    sheet++;

    // content: Cookie Added - Cookie Deleted
    s = wb.createSheet();
    wb.setSheetName(sheet, "Cookies Added-Deleted");
    this.createHeader(wb, s, "Cookies Added - Cookies Deleted Per Domain", 1);
    this.createContent(wb, s, "cookieTotals");
    sheet++;

    // content: Local Storage counts per domain
    s = wb.createSheet();
    wb.setSheetName(sheet, "Local Storage");
    this.createHeader(wb, s, "Local Storage counts per domain", 1);
    this.createContent(wb, s, "localStorageContents");
    sheet++;

    // content: Pretty Chart
    s = wb.createSheet();
    wb.setSheetName(sheet, "Overall");

    int rownum = 0, cellnum = 0;

    // Header
    r = s.createRow(rownum);
    Cell c = r.createCell(0);
    s.setColumnWidth(0, 8000);
    c.setCellValue(
            "Overall effectiveness measured by percentage of decrease vs baseline (0 for any negative effect)");

    rownum++;
    r = s.createRow(rownum);

    cellnum++;

    for (String database : decrease.keySet()) {
        if (database.equals("baseline")) {
            continue;
        }

        c = r.createCell(cellnum);
        c.setCellValue(database);

        CellStyle cs = wb.createCellStyle();
        Font f = wb.createFont();
        f.setBoldweight(Font.BOLDWEIGHT_BOLD);
        cs.setFont(f);

        c.setCellStyle(cs);
        cellnum++;
    }

    CellStyle numberStyle = wb.createCellStyle();
    numberStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("number"));

    // Content
    for (String type : decrease.get("baseline").keySet()) {
        cellnum = 0;
        rownum++;

        r = s.createRow(rownum);

        c = r.createCell(cellnum);
        c.setCellValue(type);
        cellnum++;

        for (String database : decrease.keySet()) {
            if (database.equals("baseline")) {
                continue;
            }

            c = r.createCell(cellnum);
            c.setCellStyle(numberStyle);

            double decreaseValue = Double.parseDouble(decrease.get(database).get(type));

            if (decreaseValue < 0)
                decreaseValue = 0;

            c.setCellValue(decreaseValue);
            cellnum++;
        }
    }

    /*
    for (String database : decrease.keySet()) {
       for (String type : decrease.get(database).keySet()) {
    System.out.println(database + "|" + type + "|" + decrease.get(database).get(type));
       }
    }
    */

    wb.write(file);
    file.close();
}

From source file:com.excelsiorsoft.transformer.TransformationHandler.java

License:Apache License

/**
 * Actual Spring Integration transformation handler.
 *
 * @param inputMessage Spring Integration input message
 * @return New Spring Integration message with updated headers
 *//*from   w  w w . ja  va 2  s  . co  m*/
@Transformer
public Message<byte[]> handleFile(final Message<File> inputMessage) {

    final File inputFile = inputMessage.getPayload();
    final String filename = inputFile.getName();

    final String inputAsString;

    try {
        inputAsString = FileUtils.readFileToString(inputFile);
    } catch (IOException e) {
        throw new IllegalStateException(e);
    }

    ByteArrayOutputStream bout = new ByteArrayOutputStream();

    Workbook wb = new HSSFWorkbook();
    Sheet sheet = wb.createSheet("Sample Sheet");

    // Create a row and put some cells in it. Rows are 0 based.
    Row row = sheet.createRow((short) 0);
    // Create a cell and put a value in it.
    Cell cell = row.createCell(0);

    cell.setCellValue(inputAsString);

    try {
        wb.write(bout);
    } catch (IOException e) {
        throw new IllegalStateException(e);
    }

    final Message<byte[]> message = MessageBuilder.withPayload(bout.toByteArray())
            .setHeader(FileHeaders.FILENAME, filename + ".xls").setHeader(FileHeaders.ORIGINAL_FILE, inputFile)
            .setHeader("file_size", inputFile.length()).build();

    return message;
}

From source file:com.exilant.exility.core.XlxUtil.java

License:Open Source License

private Workbook getWorkbookForFile(String fileName) {
    if (fileName.lastIndexOf('x') == fileName.length() - 1) {
        return new XSSFWorkbook();
    }//from  w  w w .j ava  2s  .  c o m

    return new HSSFWorkbook();
}

From source file:com.eyeq.pivot4j.export.poi.ExcelExporter.java

License:Common Public License

protected Workbook createWorkbook() {
    Workbook newWorkbook = null;//from   w  w  w.j a va2s  .  com

    switch (format) {
    case XSSF:
        newWorkbook = new XSSFWorkbook();
        break;
    case HSSF:
        newWorkbook = new HSSFWorkbook();
        break;
    case SXSSF:
        newWorkbook = new SXSSFWorkbook(500);
        break;
    default:
        assert false;
    }

    return newWorkbook;
}