Example usage for org.apache.poi.hssf.usermodel HSSFCell setCellValue

List of usage examples for org.apache.poi.hssf.usermodel HSSFCell setCellValue

Introduction

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

Prototype

@SuppressWarnings("fallthrough")
public void setCellValue(boolean value) 

Source Link

Document

set a boolean value for the cell

Usage

From source file:com.jfinal.ext.render.excel.PoiKit.java

License:Apache License

public HSSFWorkbook export() {
    Preconditions.checkNotNull(headers, "headers can not be null");
    Preconditions.checkNotNull(columns, "columns can not be null");
    Preconditions.checkArgument(cellWidth >= 0, "cellWidth < 0");
    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet sheet = wb.createSheet(sheetName);
    HSSFRow row = null;/*from w  w w.j  a va  2s .  c o m*/
    HSSFCell cell = null;
    if (headers.length > 0) {
        row = sheet.createRow(0);
        if (headerRow <= 0) {
            headerRow = HEADER_ROW;
        }
        headerRow = Math.min(headerRow, MAX_ROWS);
        for (int h = 0, lenH = headers.length; h < lenH; h++) {
            @SuppressWarnings("deprecation")
            Region region = new Region(0, (short) h, (short) headerRow - 1, (short) h);// ?rowFromcolumnFrom
            sheet.addMergedRegion(region);// rowTocolumnTo
            // 
            sheet.getNumMergedRegions();
            if (cellWidth > 0) {
                sheet.setColumnWidth(h, cellWidth);
            }
            cell = row.createCell(h);
            cell.setCellValue(headers[h]);
        }
    }
    if (data.size() == 0) {
        return wb;
    }
    for (int i = 0, len = data.size(); i < len; i++) {
        row = sheet.createRow(i + headerRow);
        Object obj = data.get(i);
        if (obj == null) {
            continue;
        }
        if (obj instanceof Map) {
            processAsMap(columns, row, obj);
        } else if (obj instanceof Model) {
            processAsModel(columns, row, obj);
        } else if (obj instanceof Record) {
            processAsRecord(columns, row, obj);
        }
    }
    return wb;
}

From source file:com.jfinal.ext.render.excel.PoiKit.java

License:Apache License

@SuppressWarnings("unchecked")
private static void processAsMap(String[] columns, HSSFRow row, Object obj) {
    HSSFCell cell;
    Map<String, Object> map = (Map<String, Object>) obj;
    if (columns.length == 0) {// 
        Set<String> keys = map.keySet();
        int columnIndex = 0;
        for (String key : keys) {
            cell = row.createCell(columnIndex);
            cell.setCellValue(map.get(key) + "");
            columnIndex++;//  www .  j  a va 2 s  .  c  o m
        }
    } else {
        for (int j = 0, lenJ = columns.length; j < lenJ; j++) {
            cell = row.createCell(j);
            cell.setCellValue(map.get(columns[j]) + "");
        }
    }
}

From source file:com.jfinal.ext.render.excel.PoiKit.java

License:Apache License

private static void processAsModel(String[] columns, HSSFRow row, Object obj) {
    HSSFCell cell;
    Model<?> model = (Model<?>) obj;
    Set<Entry<String, Object>> entries = model.getAttrsEntrySet();
    if (columns.length == 0) {// 
        int columnIndex = 0;
        for (Entry<String, Object> entry : entries) {
            cell = row.createCell(columnIndex);
            cell.setCellValue(entry.getValue() + "");
            columnIndex++;/*from w w  w  . j a va2  s.  c o  m*/
        }
    } else {
        for (int j = 0, lenJ = columns.length; j < lenJ; j++) {
            cell = row.createCell(j);
            cell.setCellValue(model.get(columns[j]) + "");
        }
    }
}

From source file:com.jfinal.ext.render.excel.PoiKit.java

License:Apache License

private static void processAsRecord(String[] columns, HSSFRow row, Object obj) {
    HSSFCell cell;
    Record record = (Record) obj;// ww  w  . j  a va 2 s .c  o m
    Map<String, Object> map = record.getColumns();
    if (columns.length == 0) {// 
        record.getColumns();
        Set<String> keys = map.keySet();
        int columnIndex = 0;
        for (String key : keys) {
            cell = row.createCell(columnIndex);
            cell.setCellValue(record.get(key) + "");
            columnIndex++;
        }
    } else {
        for (int j = 0, lenJ = columns.length; j < lenJ; j++) {
            cell = row.createCell(j);
            cell.setCellValue(map.get(columns[j]) + "");
        }
    }
}

From source file:com.jitendrasinghnz.excelreadutility.ExcelReadStringArrayXSL.java

License:Open Source License

public void setOutputSingletResult(String[][] inputData, String[] outputResult, String filePath) {
    String[][] outputResultTwoDimensionArray;
    outputResultTwoDimensionArray = new String[inputData.length][inputData[0].length + 1];
    Path folderPath = null;/*from  w  ww .ja va  2s.c  om*/
    try {
        folderPath = Paths.get(filePath);
    } catch (InvalidPathException i) {
        System.out.println("Please Check whether " + filePath + " exist ");
    }
    for (int i = 0; i < outputResultTwoDimensionArray.length; i++) {
        for (int j = 0; j < outputResultTwoDimensionArray[i].length; j++) {
            if (j == (outputResultTwoDimensionArray[i].length - 1)) {
                for (int k = j; k < outputResultTwoDimensionArray[i].length; k++) {
                    outputResultTwoDimensionArray[i][k] = outputResult[i];
                }
            } else
                outputResultTwoDimensionArray[i][j] = inputData[i][j];
        }
    }

    CharSequence filepathWindows = "\\";
    CharSequence filepathGNULinux = "/";
    try {
        if (filePath.contains(filepathWindows) || filePath.contains(filepathGNULinux)) {
            String filename = "test_output_singlet_" + String.valueOf(System.currentTimeMillis()) + ".xls";
            String finalFileName = filePath + filename;
            FileOutputStream outputFile = new FileOutputStream(finalFileName);
            HSSFWorkbook hSSFWorkbook = new HSSFWorkbook();
            HSSFSheet hSSFSheet = hSSFWorkbook.createSheet("output");
            for (int i = 0; i < outputResultTwoDimensionArray.length; i++) {
                HSSFRow row = hSSFSheet.createRow(i);
                for (int j = 0; j < outputResultTwoDimensionArray[i].length; j++) {
                    HSSFCell cell = row.createCell(j);
                    cell.setCellValue(outputResultTwoDimensionArray[i][j]);
                }
            }
            hSSFWorkbook.write(outputFile);
            outputFile.flush();
            outputFile.close();
            System.out.println("An output file named \"" + filename + "\" was created at \"" + filePath + "\"");
            System.out.println("Good Bye !!!");
        }
    } catch (FileNotFoundException fnfe) {
        System.out.println("Sorry " + filePath + " does not exist");
    }

    catch (IOException ioe) {
        System.out.println("Error to open/close file from path " + filePath);
    }

}

From source file:com.jitendrasinghnz.excelreadutility.ExcelReadStringArrayXSL.java

License:Open Source License

public void setOutputResult(String[][] inputData, String[][] outputResult, String filePath) {
    String[][] outputResultTwoDimensionArray;
    outputResultTwoDimensionArray = new String[inputData.length][inputData[0].length + outputResult[0].length];
    Path folderPath = null;// w ww  .  j a  va  2s  .  c  om
    try {
        folderPath = Paths.get(filePath);
    } catch (InvalidPathException i) {
        System.out.println("Please Check whether " + filePath + " exist ");
    }
    for (int i = 0; i < outputResultTwoDimensionArray.length; i++) {
        for (int j = 0; j < outputResultTwoDimensionArray[i].length; j++) {
            if (j >= (outputResultTwoDimensionArray[i].length - outputResult[i].length)) {

                outputResultTwoDimensionArray[i][j] = outputResult[i][j
                        - (outputResultTwoDimensionArray[i].length - outputResult[i].length)];

            } else
                outputResultTwoDimensionArray[i][j] = inputData[i][j];
        }
    }
    CharSequence filepathWindows = "\\";
    CharSequence filepathGNULinux = "/";
    try {
        if (filePath.contains(filepathWindows) || filePath.contains(filepathGNULinux)) {
            String filename = "test_output_" + String.valueOf(System.currentTimeMillis()) + ".xls";
            String finalFileName = filePath + filename;
            FileOutputStream outputFile = new FileOutputStream(finalFileName);
            HSSFWorkbook hSSFWorkbook = new HSSFWorkbook();
            HSSFSheet hSSFSheet = hSSFWorkbook.createSheet("output");
            for (int i = 0; i < outputResultTwoDimensionArray.length; i++) {
                HSSFRow row = hSSFSheet.createRow(i);
                for (int j = 0; j < outputResultTwoDimensionArray[i].length; j++) {
                    HSSFCell cell = row.createCell(j);
                    cell.setCellValue(outputResultTwoDimensionArray[i][j]);
                }
            }
            hSSFWorkbook.write(outputFile);
            outputFile.flush();
            outputFile.close();
            System.out.println("An output file named \"" + filename + "\" was created at \"" + filePath + "\"");
            System.out.println("Good Bye !!!");
        }
    } catch (FileNotFoundException fnfe) {
        System.out.println("Sorry " + filePath + " does not exist");
    }

    catch (IOException ioe) {
        System.out.println("Error to open/close file from path " + filePath);
    }
}

From source file:com.jk.framework.util.ExcelUtil.java

License:Apache License

/**
 *///from  w  ww  . java2s.  c  o  m
protected void createColumnHeaders() {
    final HSSFRow headersRow = this.sheet.createRow(0);
    final HSSFFont font = this.workbook.createFont();
    font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
    final HSSFCellStyle style = this.workbook.createCellStyle();
    style.setFont(font);
    style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    int counter = 1;
    for (int i = 0; i < this.model.getColumnCount(); i++) {
        final HSSFCell cell = headersRow.createCell(counter++);
        // cell.setEncoding(HSSFCell.ENCODING_UTF_16);
        cell.setCellValue(this.model.getColumnName(i));
        cell.setCellStyle(style);
    }
}

From source file:com.jk.framework.util.ExcelUtil.java

License:Apache License

/**
 * @param cell//from  w w w.  ja va  2  s. c  o  m
 * @param value
 */
private void setValue(final HSSFCell cell, final Object value) {
    if (value == null) {
        cell.setCellValue("-");
    } else if (value instanceof Float || value instanceof Double || value instanceof Integer
            || value instanceof Long || value instanceof BigDecimal) {
        cell.setCellValue(Double.parseDouble(value.toString()));
    } else if (value instanceof String) {
        cell.setCellValue(value.toString());
    } else if (value instanceof Date) {
        cell.setCellValue((Date) value);
    } else {
        logger.info("No Special excel r endering for class : " + value.getClass().getName());
        cell.setCellValue(value.toString());
    }
}

From source file:com.jshuabo.reportcenter.server.service.automoblie.impl.DefaultAutoRecordServiceImpl.java

License:Open Source License

@Override
public String importDataToExcel(HttpServletRequest request, HttpServletResponse response) {
    String realPath = request.getSession().getServletContext().getRealPath("/");
    Map<String, Object> params = new HashMap<String, Object>();
    Subject subject = SecurityUtils.getSubject();
    User user = (User) subject.getPrincipal();
    String userId = user.getId().toString();
    if (!"1".equals(userId) && !"50".equals(userId) && !"38".equals(userId) && !"53".equals(userId)
            && !"15".equals(userId) && !"16".equals(userId) && !"17".equals(userId)) {
        // FY FY_NJ 33
        params.put("subStation", user.getId());
    } else {/*from  ww  w  . j  a v  a 2 s.  co  m*/
        // ggz bj WHY zht
        params.put("subStation", request.getParameter("subStation"));
    }
    params.put("name", request.getParameter("name"));
    params.put("sortOrder", null);
    params.put("offset", null);
    params.put("rows", null);
    List<AutoRecordData> autoRecordDataList = autoRecordDataMapper.page(params);
    String _fileName = null;
    FileOutputStream out = null;
    Map<String, Object> subStationMap = new HashMap<String, Object>();
    subStationMap.put("18", "?");
    subStationMap.put("19", "");
    subStationMap.put("20", "");
    subStationMap.put("21", "");
    subStationMap.put("22", "?");
    subStationMap.put("23", "");
    subStationMap.put("24", "?");
    subStationMap.put("25", "");
    subStationMap.put("26", "");
    subStationMap.put("27", "?");
    subStationMap.put("28", "");
    subStationMap.put("29", "");
    subStationMap.put("30", "");
    subStationMap.put("31", "?");
    subStationMap.put("32", "");
    subStationMap.put("33", "?");
    subStationMap.put("51", "");
    try {
        // 
        HSSFWorkbook wb = new HSSFWorkbook();
        // 
        HSSFSheet sheet = wb.createSheet("");
        HSSFRow firstRow = sheet.createRow(0);
        firstRow.createCell(0).setCellValue("");
        firstRow.createCell(1).setCellValue("???");
        firstRow.createCell(2).setCellValue("");
        firstRow.createCell(3).setCellValue("?");
        firstRow.createCell(4).setCellValue("?(???)");
        firstRow.createCell(5).setCellValue("?");
        firstRow.createCell(6).setCellValue("");
        firstRow.createCell(7).setCellValue("");
        firstRow.createCell(8).setCellValue("??");
        firstRow.createCell(9).setCellValue("???");
        firstRow.createCell(10).setCellValue("???");
        firstRow.createCell(11).setCellValue("??");
        firstRow.createCell(12).setCellValue("??");
        firstRow.createCell(13).setCellValue("");
        firstRow.createCell(14).setCellValue("??");
        firstRow.createCell(15).setCellValue("");
        firstRow.createCell(16).setCellValue("?");
        firstRow.createCell(17).setCellValue("???");
        firstRow.createCell(18).setCellValue("???");
        firstRow.createCell(19).setCellValue("???");
        firstRow.createCell(20).setCellValue("?");
        firstRow.createCell(21).setCellValue("??");
        firstRow.createCell(22).setCellValue("????");
        firstRow.createCell(23).setCellValue("????");
        firstRow.createCell(24).setCellValue("???");
        firstRow.createCell(25).setCellValue("??");
        firstRow.createCell(26).setCellValue("??");
        firstRow.createCell(27).setCellValue("???");
        firstRow.createCell(28).setCellValue("??");
        firstRow.createCell(29).setCellValue("??");
        firstRow.createCell(30).setCellValue("??");
        firstRow.createCell(31).setCellValue("??");
        firstRow.createCell(32).setCellValue("??");
        firstRow.createCell(33).setCellValue("????");
        firstRow.createCell(34).setCellValue("?");

        if (autoRecordDataList.size() > 0) {
            for (int j = 1; j < autoRecordDataList.size() + 1; ++j) {
                HSSFRow row = sheet.createRow(j);

                // subStation 
                HSSFCell subStation = row.createCell(0);
                subStation.setCellValue(
                        subStationMap.get(autoRecordDataList.get(j - 1).getSubStation()).toString());

                // deputyCard ???
                HSSFCell deputyCard = row.createCell(1);
                deputyCard.setCellValue(autoRecordDataList.get(j - 1).getDeputyCard());

                // carKind 
                HSSFCell carKind = row.createCell(2);
                carKind.setCellValue(autoRecordDataList.get(j - 1).getCarKind());

                // licenseNo ?
                HSSFCell licenseNo = row.createCell(3);
                licenseNo.setCellValue(autoRecordDataList.get(j - 1).getLicenseNo());

                // license ?(???)
                HSSFCell license = row.createCell(4);
                license.setCellValue(autoRecordDataList.get(j - 1).getLicense());

                // licenseDate ?
                HSSFCell licenseDate = row.createCell(5);
                licenseDate.setCellValue(null == autoRecordDataList.get(j - 1).getLicenseDate() ? ""
                        : DateFormatUtils.format(autoRecordDataList.get(j - 1).getLicenseDate(),
                                DateFormatUtils.ymd));

                // licenseName 
                HSSFCell licenseName = row.createCell(6);
                licenseName.setCellValue(autoRecordDataList.get(j - 1).getLicenseName());

                // inspectionDate 
                HSSFCell inspectionDate = row.createCell(7);
                inspectionDate.setCellValue(null == autoRecordDataList.get(j - 1).getInspectionDate() ? ""
                        : DateFormatUtils.format(autoRecordDataList.get(j - 1).getInspectionDate(),
                                DateFormatUtils.ymd));

                // name ??
                HSSFCell name = row.createCell(8);
                name.setCellValue(autoRecordDataList.get(j - 1).getName());

                // idCard ???
                HSSFCell idCard = row.createCell(9);
                idCard.setCellValue(autoRecordDataList.get(j - 1).getIdCard());

                // ftReceive ???
                HSSFCell ftReceive = row.createCell(10);
                ftReceive.setCellValue(null == autoRecordDataList.get(j - 1).getFtReceive() ? ""
                        : DateFormatUtils.format(autoRecordDataList.get(j - 1).getFtReceive(),
                                DateFormatUtils.ymd));

                // changeDate ??
                HSSFCell changeDate = row.createCell(11);
                changeDate.setCellValue(null == autoRecordDataList.get(j - 1).getChangeDate() ? ""
                        : DateFormatUtils.format(autoRecordDataList.get(j - 1).getChangeDate(),
                                DateFormatUtils.ymd));

                // telephone ??
                HSSFCell telephone = row.createCell(12);
                telephone.setCellValue(autoRecordDataList.get(j - 1).getTelephone());

                // strongInsDate 
                HSSFCell strongInsDate = row.createCell(13);
                strongInsDate.setCellValue(null == autoRecordDataList.get(j - 1).getStrongInsDate() ? ""
                        : DateFormatUtils.format(autoRecordDataList.get(j - 1).getStrongInsDate(),
                                DateFormatUtils.ymd));

                // tLInsurance ?? (?)
                HSSFCell tLInsurance = row.createCell(14);
                Double _tLInsurance = autoRecordDataList.get(j - 1).gettLInsurance();
                if (null == _tLInsurance) {
                    tLInsurance.setCellValue("");
                } else {
                    tLInsurance.setCellValue(_tLInsurance);
                }

                // tLInsuranceDate 
                HSSFCell tLInsuranceDate = row.createCell(15);
                tLInsuranceDate.setCellValue(null == autoRecordDataList.get(j - 1).gettLInsuranceDate() ? ""
                        : DateFormatUtils.format(autoRecordDataList.get(j - 1).gettLInsuranceDate(),
                                DateFormatUtils.ymd));

                // policeProve ?
                HSSFCell policeProve = row.createCell(16);
                policeProve.setCellValue(autoRecordDataList.get(j - 1).getPoliceProve());

                // householdCopy ???
                HSSFCell householdCopy = row.createCell(17);
                householdCopy.setCellValue(autoRecordDataList.get(j - 1).getHouseholdCopy());

                // idCardCopy ???
                HSSFCell idCardCopy = row.createCell(18);
                idCardCopy.setCellValue(autoRecordDataList.get(j - 1).getIdCardCopy());

                // licenseCopy ???
                HSSFCell licenseCopy = row.createCell(19);
                licenseCopy.setCellValue(autoRecordDataList.get(j - 1).getLicenseCopy());

                // guaranRespon ?
                HSSFCell guaranRespon = row.createCell(20);
                guaranRespon.setCellValue(autoRecordDataList.get(j - 1).getGuaranRespon());

                // guaranIncome ??
                HSSFCell guaranIncome = row.createCell(21);
                guaranIncome.setCellValue(autoRecordDataList.get(j - 1).getGuaranIncome());

                // guaranHouseCopy ????
                HSSFCell guaranHouseCopy = row.createCell(22);
                guaranHouseCopy.setCellValue(autoRecordDataList.get(j - 1).getGuaranHouseCopy());

                // guaranIDCopy ????
                HSSFCell guaranIDCopy = row.createCell(23);
                guaranIDCopy.setCellValue(autoRecordDataList.get(j - 1).getGuaranIDCopy());

                // driLicenseCopy ???
                HSSFCell driLicenseCopy = row.createCell(24);
                driLicenseCopy.setCellValue(autoRecordDataList.get(j - 1).getDriLicenseCopy());

                // strongInsCopy ??
                HSSFCell strongInsCopy = row.createCell(25);
                strongInsCopy.setCellValue(autoRecordDataList.get(j - 1).getStrongInsCopy());

                // commerInsuCopy ??
                HSSFCell commerInsuCopy = row.createCell(26);
                commerInsuCopy.setCellValue(autoRecordDataList.get(j - 1).getCommerInsuCopy());

                // certificate ???
                HSSFCell certificate = row.createCell(27);
                certificate.setCellValue(autoRecordDataList.get(j - 1).getCertificate());

                // agreeDate ??
                HSSFCell agreeDate = row.createCell(28);
                agreeDate.setCellValue(null == autoRecordDataList.get(j - 1).getAgreeDate() ? ""
                        : DateFormatUtils.format(autoRecordDataList.get(j - 1).getAgreeDate(),
                                DateFormatUtils.ymd));

                // rentalAgreement ??
                HSSFCell rentalAgreement = row.createCell(29);
                rentalAgreement.setCellValue(autoRecordDataList.get(j - 1).getRentalAgreement());

                // strongInsPrompt ??
                HSSFCell strongInsPrompt = row.createCell(30);
                strongInsPrompt.setCellValue(autoRecordDataList.get(j - 1).getStrongInsPrompt());

                // tLInsurancePrompt ??
                HSSFCell tLInsurancePrompt = row.createCell(31);
                tLInsurancePrompt.setCellValue(autoRecordDataList.get(j - 1).gettLInsurancePrompt());

                // inspectionPrompt ??
                HSSFCell inspectionPrompt = row.createCell(32);
                inspectionPrompt.setCellValue(autoRecordDataList.get(j - 1).getInspectionPrompt());

                // changePrompt ????
                HSSFCell changePrompt = row.createCell(33);
                changePrompt.setCellValue(autoRecordDataList.get(j - 1).getChangePrompt());

                // status ?
                HSSFCell status = row.createCell(34);
                status.setCellValue(autoRecordDataList.get(j - 1).getStatus());
            }
        }

        _fileName = "excel" + DateFormatUtils.format(new Date(), "yyyy-MM-dd-HH_mm_ss-SSS") + ".xls";

        String fileName = realPath + File.separator + _fileName;
        out = new FileOutputStream(fileName);

        wb.write(out);

    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        // ?
        try {
            if (null != out) {
                out.close();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    return _fileName;
}

From source file:com.kiwisoft.db.export.ExcelExporter.java

License:Open Source License

public void exportTable(JTable table, SQLStatement statement, File file, ExportConfiguration configuration)
        throws Exception {
    HSSFWorkbook workbook = new HSSFWorkbook();
    HSSFSheet sheet = workbook.createSheet("Query");
    TableColumnModel columnModel = table.getColumnModel();
    ResultSetTableModel tableModel = (ResultSetTableModel) table.getModel();
    HSSFFont headerFont = workbook.createFont();
    headerFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
    HSSFCellStyle headerStyle = workbook.createCellStyle();
    headerStyle.setFont(headerFont);/*from  ww  w  .j  a v a  2s.c  o  m*/
    headerStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    int rowNum = 0;
    HSSFRow row = sheet.createRow(rowNum++);
    sheet.createFreezePane(0, 1);
    int columnCount = columnModel.getColumnCount();
    for (short i = 0; i < columnCount; i++) {
        TableColumn column = columnModel.getColumn(i);
        int columnIndex = column.getModelIndex();
        HSSFCell cell = row.createCell(i);
        cell.setCellStyle(headerStyle);
        String columnName = tableModel.getColumnName(columnIndex);
        cell.setCellValue(columnName);
    }
    for (int j = 0; j < tableModel.getRowCount(); j++) {
        row = sheet.createRow(rowNum++);
        for (short i = 0; i < columnCount; i++) {
            TableColumn column = columnModel.getColumn(i);
            int columnIndex = column.getModelIndex();
            Object cellValue = tableModel.getValueAt(j, columnIndex);
            HSSFCell cell = row.createCell(i);
            if (cellValue instanceof Number)
                cell.setCellValue(((Number) cellValue).doubleValue());
            else if (cellValue instanceof Date) {

                HSSFCellStyle style = workbook.createCellStyle();
                style.setDataFormat((short) 14);
                cell.setCellValue((Date) cellValue);
                cell.setCellStyle(style);
            } else if (cellValue instanceof Boolean)
                cell.setCellValue(((Boolean) cellValue).booleanValue());
            else if (cellValue != null)
                cell.setCellValue(cellValue.toString());
        }
    }
    FileOutputStream out = new FileOutputStream(file);
    workbook.write(out);
    Field field = ClassLoader.class.getDeclaredField("classes");
    field.setAccessible(true);
    Vector classes = (Vector) field.get(HSSFWorkbook.class.getClassLoader());
    field.setAccessible(false);
    System.out.println("classes = " + StringUtils.enumerate(classes, "\n"));
    out.close();
}