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

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

Introduction

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

Prototype

@Override
public HSSFCellStyle createCellStyle() 

Source Link

Document

Create a new Cell style and add it to the workbook's style table.

Usage

From source file:it.cineca.pst.huborcid.web.rest.ReportatFileResource.java

License:Open Source License

/**
 * GET  /reportat -> get all the relPersonApplications.
 *///from   w  w  w .j a  va  2  s .c  o  m
@RequestMapping(value = "/reportat/downloadExcel", method = RequestMethod.GET)
@Timed
public void getExcel(HttpServletResponse response) throws URISyntaxException {
    String currentLogin = SecurityUtils.getCurrentLogin();
    Application application = applicationRepository.findOneByApplicationID(currentLogin);
    Sort sort = new Sort(Sort.Direction.ASC, "person.localID");
    List<RelPersonApplication> listAccessToken = relPersonApplicationRepository
            .findAllByLastIsTrueAndApplicationIs(application, sort);

    HSSFWorkbook workbook = new HSSFWorkbook();
    HSSFSheet sheet = workbook.createSheet("Report Access Token");

    Object[] headerExcel = new Object[] { "LOCAL ID", "ORCID", "ORCID ASSOCIATION DATE", "ORCID ACCESS TOKEN",
            "ORCID ACCESS TOKEN RELEASED DATE" };
    Row rowHeader = sheet.createRow(0);
    int cellnumHeader = 0;
    //header
    for (Object obj : headerExcel) {
        Cell cell = rowHeader.createCell(cellnumHeader++);
        if (obj instanceof Date)
            cell.setCellValue((Date) obj);
        else if (obj instanceof Boolean)
            cell.setCellValue((Boolean) obj);
        else if (obj instanceof String)
            cell.setCellValue((String) obj);
        else if (obj instanceof Double)
            cell.setCellValue((Double) obj);
    }

    //data

    CellStyle cellStyle = workbook.createCellStyle();
    CreationHelper createHelper = workbook.getCreationHelper();
    cellStyle.setDataFormat(createHelper.createDataFormat().getFormat("m/d/yy"));

    int rownum = 1;
    for (int i = 0; i < listAccessToken.size(); i++) {
        RelPersonApplication relPerson = listAccessToken.get(i);
        Row rowData = sheet.createRow(rownum++);
        int cellnumData = 0;
        //localid
        Cell cellLocalId = rowData.createCell(cellnumData++);
        cellLocalId.setCellValue(relPerson.getPerson().getLocalID());

        //orcid
        Cell cellOrcid = rowData.createCell(cellnumData++);
        cellOrcid.setCellValue(relPerson.getPerson().getOrcid());

        //orcidCreated
        Cell cellOrcidCreated = rowData.createCell(cellnumData++);
        if (relPerson.getPerson().getOrcidReleaseDate() != null) {
            cellOrcidCreated.setCellValue(relPerson.getPerson().getOrcidReleaseDate().toDate());
            cellOrcidCreated.setCellStyle(cellStyle);
        }

        //orcid access token
        Cell callAccessToken = rowData.createCell(cellnumData++);
        if ((relPerson.getDenied() == null) || (relPerson.getDenied() == false)) {
            callAccessToken.setCellValue(relPerson.getOauthAccessToken());
        } else {
            callAccessToken.setCellValue((String) null);
        }

        //access token Created
        Cell cellAccessTokenCreated = rowData.createCell(cellnumData++);
        if (relPerson.getDateReleased() != null) {
            if ((relPerson.getDenied() == null) || (relPerson.getDenied() == false)) {
                cellAccessTokenCreated.setCellValue(relPerson.getDateReleased().toDate());
                cellAccessTokenCreated.setCellStyle(cellStyle);
            } else {
                //cellAccessTokenCreated.setCellValue((Date)null);
                cellAccessTokenCreated.setCellStyle(cellStyle);
            }
        }

        //          //FIXME quando verr gestita la revoca
        //          //denied
        //          Cell cellDenied = rowData.createCell(cellnumData++);
        //          if(relPerson.getDenied()!=null)
        //             cellDenied.setCellValue(new Boolean(null));
    }

    //autosize
    for (int i = 0; i < headerExcel.length; i++) {
        sheet.autoSizeColumn(i);
    }

    try {
        workbook.write(response.getOutputStream());

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

}

From source file:it.cnr.ibimet.bikeclimate.backingbeans.FotovoltaicDataBean.java

public void postProcessXLS(Object document) {
    HSSFWorkbook wb = (HSSFWorkbook) document;
    HSSFSheet sheet = wb.getSheetAt(0);//from   www .j  av  a2s.c om
    HSSFRow header = sheet.getRow(0);
    HSSFCellStyle cellStyle = wb.createCellStyle();
    cellStyle.setFillForegroundColor(HSSFColor.GREEN.index);
    cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);

    //Create header
    for (int i = 0; i < header.getPhysicalNumberOfCells(); i++) {
        header.getCell(i).setCellStyle(cellStyle);
        header.getCell(i).setCellValue(columns.get(i).getHeader());

    }

    //create data table

    for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
        header = sheet.getRow(i);

        for (int j = 0; j < header.getPhysicalNumberOfCells(); j++) {
            header.getCell(j).setCellValue(dati.get(i).get(columns.get(j).getProperty()));
        }
    }
}

From source file:it.cnr.ibimet.bikeclimate.backingbeans.FotovoltaicDataBean.java

public void postProcessXLSStat(Object document) {
    HSSFWorkbook wb = (HSSFWorkbook) document;
    HSSFSheet sheet = wb.getSheetAt(0);// ww  w .java 2  s  .  c  o  m
    HSSFRow header = sheet.getRow(0);
    HSSFCellStyle cellStyle = wb.createCellStyle();
    cellStyle.setFillForegroundColor(HSSFColor.GREEN.index);
    cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);

    //Create header
    for (int i = 0; i < header.getPhysicalNumberOfCells(); i++) {
        header.getCell(i).setCellStyle(cellStyle);
        header.getCell(i).setCellValue(columnsStat.get(i).getHeader());

    }

    //create data table

    for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
        header = sheet.getRow(i);

        for (int j = 0; j < header.getPhysicalNumberOfCells(); j++) {
            header.getCell(j).setCellValue(datiStat.get(i).get(columnsStat.get(j).getProperty()));
        }
    }
}

From source file:jp.co.opentone.bsol.framework.core.generator.excel.strategy.PoiWorkbookGeneratorStrategy.java

License:Apache License

/**
 * MS Excel??./*from   w  ww  . java 2 s .c  o  m*/
 * <p>
 * ????????11???. ??????????????????.
 * ????????????.
 * </p>
 * @param context Excel???
 * @return MS Excel
 */
public byte[] generate(WorkbookGeneratorContext context) {
    if (LOG.isDebugEnabled()) {
        LOG.debug("generate start");
    }
    checkState(context);

    HSSFWorkbook workBook = new HSSFWorkbook();
    HSSFSheet sheet = workBook.createSheet(context.sheetName);
    HSSFCellStyle style = workBook.createCellStyle();
    setBorder(context, style);

    // ?
    int count = 0;
    if (createHeader(context, sheet, style)) {
        count++;
    }
    if (LOG.isDebugEnabled()) {
        LOG.debug("  createRow start");
    }
    // ?
    createRow(context, workBook, sheet, count, style);
    if (LOG.isDebugEnabled()) {
        LOG.debug("  createRow end");
    }

    try {
        if (LOG.isDebugEnabled()) {
            LOG.debug("  toByte start");
        }
        // ??????
        return toByte(workBook);
    } finally {
        if (LOG.isDebugEnabled()) {
            LOG.debug("  toByte end");
        }
    }
}

From source file:jp.co.opentone.bsol.framework.core.generator.excel.strategy.PoiWorkbookGeneratorStrategy.java

License:Apache License

private HSSFCellStyle initializeDateCellStyle(HSSFWorkbook workbook, HSSFCellStyle baseStyle) {
    HSSFCellStyle dateStyle = workbook.createCellStyle();
    dateStyle.cloneStyleFrom(baseStyle);
    dateStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("d-mmm-yy"));
    return dateStyle;
}

From source file:kitt.admin.controller.UserController.java

@RequestMapping(value = "/downloadData")
@Authority(role = AuthenticationRole.Service)
@Authority(role = AuthenticationRole.TraderAssistant)
@Authority(role = AuthenticationRole.LegalPersonnel)
@Authority(role = AuthenticationRole.Admin)
@Authority(role = AuthenticationRole.Operation)
public void downloadUserData(String status,
        @RequestParam(value = "securephone", required = false, defaultValue = "") String securephone,
        @RequestParam(value = "clienttype", required = false, defaultValue = "0") int clienttype,
        @RequestParam(value = "startDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate startDate,
        @RequestParam(value = "endDate", required = false) @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) LocalDate endDate,
        HttpServletRequest request, HttpServletResponse response) throws IOException, DocumentException {
    List<Map<String, Object>> users = userMapper.userExport(status, Where.$like$(securephone), clienttype,
            startDate, endDate);//from  ww  w .  j ava 2 s  .co m
    String filename = status + "?";
    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet sheet = wb.createSheet(filename);
    HSSFRow row = sheet.createRow(0);
    CellStyle cellStyle = wb.createCellStyle();
    cellStyle.setAlignment(CellStyle.ALIGN_CENTER);
    cellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    sheet.setVerticallyCenter(true);
    sheet.setHorizontallyCenter(true);
    sheet.setColumnWidth(0, 1200);
    sheet.setColumnWidth(1, 3600);
    sheet.setColumnWidth(2, 8000);
    sheet.setColumnWidth(3, 4500);
    sheet.setColumnWidth(4, 4500);
    String[] excelHeader = { "??", "", "??", "??",
            "" };
    for (int i = 0; i < excelHeader.length; i++) {
        sheet.autoSizeColumn(i, true);
        HSSFCell cell = row.createCell(i);
        cell.setCellValue(excelHeader[i]);
        cell.setCellStyle(cellStyle);
    }
    for (int i = 0; i < users.size(); i++) {
        Map<String, Object> resultSet = users.get(i);
        sheet.autoSizeColumn(i, true);
        row = sheet.createRow(i + 1);
        row.setRowStyle(cellStyle);
        row.createCell(0).setCellValue(i + 1);
        row.createCell(1).setCellValue(String.valueOf(resultSet.get("tradername")).equals("null") ? ""
                : String.valueOf(resultSet.get("tradername")));
        row.createCell(2).setCellValue(String.valueOf(resultSet.get("companyname")));
        row.createCell(3).setCellValue(String.valueOf(resultSet.get("securephone")));
        row.createCell(4).setCellValue(String.valueOf(resultSet.get("verifytime")));
    }
    response.setCharacterEncoding("UTF-8");
    response.setContentType("application/x-download");
    filename += LocalDate.now() + ".xls";
    if (request.getHeader("user-agent").toLowerCase().contains("firefox")) {
        filename = new String(filename.getBytes("UTF-8"), "ISO-8859-1");
    } else {
        filename = URLEncoder.encode(filename, "UTF-8");
    }
    response.addHeader("Content-Disposition", "attachment; filename=" + filename);
    OutputStream out = response.getOutputStream();
    wb.write(out);
    out.close();
}

From source file:kr.co.blackducksoftware.rg.displayexcel.Style.java

public static void coverStyle(HSSFWorkbook myWorkbook) {

    coverlineStyle = myWorkbook.createCellStyle();
    coverlineStyle.setFillForegroundColor(HSSFColor.LIGHT_BLUE.index);

}

From source file:kr.co.blackducksoftware.rg.displayexcel.Style.java

/**
 * /*from w w  w  .  j a v  a  2 s  .  c  o m*/
 * ?? ???? ???? ????
 * 
 */

public static void setStyles(HSSFWorkbook myWorkbook) {

    /**
     * Written by byunghoon
     * ossw_Cover ? ?
     */
    osswCoverCellStyel = myWorkbook.createCellStyle();
    osswCoverCellStyel.setFillForegroundColor(HSSFColor.DARK_BLUE.index);
    osswCoverCellStyel.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);

    osswCoverCellStyelfont = myWorkbook.createCellStyle();
    osswCoverCellStyelfont.setFont(osswCoverFont);
    //osswcoverCellStyelfont.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
    osswCoverCellStyelfont.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    osswCoverCellStyelfont.setWrapText(false);

    /**
     * Written by byunghoon
     * ossw_Summary ? ?
     */
    //  
    osswSummaryCellStyel_1 = myWorkbook.createCellStyle();
    osswSummaryCellStyel_1.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
    osswSummaryCellStyel_1.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
    osswSummaryCellStyel_1.setBorderTop(HSSFCellStyle.BORDER_THIN);
    osswSummaryCellStyel_1.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    osswSummaryCellStyel_1.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    //osswSummaryCellStyel_1.setTopBorderColor(HSSFColor.BLACK.index);

    //  
    osswSummaryCellStyel_2 = myWorkbook.createCellStyle();
    osswSummaryCellStyel_2.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
    osswSummaryCellStyel_2.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
    osswSummaryCellStyel_2.setBorderTop(HSSFCellStyle.BORDER_THIN);
    osswSummaryCellStyel_2.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    osswSummaryCellStyel_2.setBorderRight(HSSFCellStyle.BORDER_THIN);
    //osswSummaryCellStyel_2.setBottomBorderColor(HSSFColor.BLACK.index);      

    //  
    osswSummaryCellStyel_3 = myWorkbook.createCellStyle();
    osswSummaryCellStyel_3.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
    osswSummaryCellStyel_3.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
    osswSummaryCellStyel_3.setFont(osswSummaryFont_1);
    osswSummaryCellStyel_3.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    osswSummaryCellStyel_3.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
    osswSummaryCellStyel_3.setBorderTop(HSSFCellStyle.BORDER_THIN);
    osswSummaryCellStyel_3.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    osswSummaryCellStyel_3.setWrapText(false);

    //  
    osswSummaryCellStyel_4 = myWorkbook.createCellStyle();
    osswSummaryCellStyel_4.setFont(osswSummaryFont_2);
    osswSummaryCellStyel_4.setAlignment(HSSFCellStyle.ALIGN_LEFT);
    osswSummaryCellStyel_4.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
    osswSummaryCellStyel_4.setBorderBottom(HSSFCellStyle.BORDER_THIN);

    //  
    osswSummaryCellStyel_5 = myWorkbook.createCellStyle();
    osswSummaryCellStyel_5.setFont(osswSummaryFont_2);
    osswSummaryCellStyel_5.setAlignment(HSSFCellStyle.ALIGN_LEFT);
    osswSummaryCellStyel_5.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
    osswSummaryCellStyel_5.setBorderTop(HSSFCellStyle.BORDER_THIN);
    osswSummaryCellStyel_5.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    osswSummaryCellStyel_5.setBorderLeft(HSSFCellStyle.BORDER_THIN);

    //  
    osswSummaryCellStyel_6 = myWorkbook.createCellStyle();
    osswSummaryCellStyel_6.setFont(osswSummaryFont_2);
    osswSummaryCellStyel_6.setBorderTop(HSSFCellStyle.BORDER_THIN);
    osswSummaryCellStyel_6.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    osswSummaryCellStyel_6.setBorderRight(HSSFCellStyle.BORDER_THIN);

    /**
     * Written by byunghoon
     * ossw_BOM ? ?
     */
    osswBOMCellStyel_1 = myWorkbook.createCellStyle();
    osswBOMCellStyel_1.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
    osswBOMCellStyel_1.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
    osswBOMCellStyel_1.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    osswBOMCellStyel_1.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
    osswBOMCellStyel_1.setBorderTop(HSSFCellStyle.BORDER_THIN);
    osswBOMCellStyel_1.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    osswBOMCellStyel_1.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    osswBOMCellStyel_1.setBorderRight(HSSFCellStyle.BORDER_THIN);
    osswBOMCellStyel_1.setFont(osswBOMFont_1);

    /**
     * Main Header Style
     */
    mainHeaderStyle = myWorkbook.createCellStyle();
    mainHeaderStyle.setFont(mainHeaderFont);
    // mainHeaderStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    mainHeaderStyle.setWrapText(false);

    /**
     * MenuLine Style
     */
    menuLineStyle = myWorkbook.createCellStyle();
    menuLineStyle.setFont(blackFont);
    // mainHeaderStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    menuLineStyle.setWrapText(false);

    /**
     * Anal Cell Style
     */
    analCellStyle = myWorkbook.createCellStyle();
    analCellStyle.setFillForegroundColor(HSSFColor.ORANGE.index);
    analCellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
    analCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    analCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    analCellStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
    analCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    analCellStyle.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
    analCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    analCellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
    analCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    analCellStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
    analCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    analCellStyle.setFont(analFont);

    analCellStyle.setWrapText(false);

    /**
     * anaDes Cell Style
     */
    anaDesCellStyle = myWorkbook.createCellStyle();
    anaDesCellStyle.setFillForegroundColor(HSSFColor.DARK_BLUE.index);
    anaDesCellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
    anaDesCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    anaDesCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    anaDesCellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    anaDesCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    anaDesCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    anaDesCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    anaDesCellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
    anaDesCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    anaDesCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    anaDesCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    anaDesCellStyle.setFont(whiteFont);

    anaDesCellStyle.setWrapText(false);

    /**
     * 1st review Cell Style (fReview)
     */
    fReviewCellStyle = myWorkbook.createCellStyle();
    fReviewCellStyle.setFillForegroundColor(HSSFColor.VIOLET.index);
    fReviewCellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
    fReviewCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    fReviewCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    fReviewCellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    fReviewCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    fReviewCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    fReviewCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    fReviewCellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
    fReviewCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    fReviewCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    fReviewCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    fReviewCellStyle.setFont(whiteFont);

    fReviewCellStyle.setWrapText(false);

    /**
     * finalHeaderCell Style (fReview)
     */
    finalHeaderCellStyle = myWorkbook.createCellStyle();
    finalHeaderCellStyle.setFillForegroundColor(HSSFColor.DARK_TEAL.index);
    finalHeaderCellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
    finalHeaderCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    finalHeaderCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    finalHeaderCellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    finalHeaderCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    finalHeaderCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    finalHeaderCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    finalHeaderCellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
    finalHeaderCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    finalHeaderCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    finalHeaderCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    finalHeaderCellStyle.setFont(whiteFont);

    finalHeaderCellStyle.setWrapText(false);

    /**
     * finalReview Cell Style (fReview)
     */
    finalReviewCellStyle = myWorkbook.createCellStyle();
    finalReviewCellStyle.setFillForegroundColor(HSSFColor.DARK_GREEN.index);
    finalReviewCellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
    finalReviewCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    finalReviewCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    finalReviewCellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    finalReviewCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    finalReviewCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    finalReviewCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    finalReviewCellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
    finalReviewCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    finalReviewCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    finalReviewCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    finalReviewCellStyle.setFont(whiteFont);

    finalReviewCellStyle.setWrapText(false);

    /**
     * src2ndrow Cell Style (fReview)
     */
    src2ndrowCellStyle = myWorkbook.createCellStyle();
    src2ndrowCellStyle.setFillForegroundColor(HSSFColor.LIGHT_BLUE.index);
    src2ndrowCellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
    src2ndrowCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    src2ndrowCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    src2ndrowCellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    src2ndrowCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    src2ndrowCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    src2ndrowCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    src2ndrowCellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
    src2ndrowCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    src2ndrowCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    src2ndrowCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    src2ndrowCellStyle.setFont(blackFont);

    src2ndrowCellStyle.setWrapText(false);

    /**
     * src2ndrowMid Cell Style (fReview)
     */
    src2ndrowMidCellStyle = myWorkbook.createCellStyle();
    src2ndrowMidCellStyle.setFillForegroundColor(HSSFColor.CORAL.index);
    src2ndrowMidCellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
    src2ndrowMidCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    src2ndrowMidCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    src2ndrowMidCellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    src2ndrowMidCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    src2ndrowMidCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    src2ndrowMidCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    src2ndrowMidCellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
    src2ndrowMidCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    src2ndrowMidCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    src2ndrowMidCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    src2ndrowMidCellStyle.setFont(blackFont);

    src2ndrowMidCellStyle.setWrapText(false);

    /**
     * src2ndrowFinal Cell Style (fReview)
     */
    src2ndrowFinalCellStyle = myWorkbook.createCellStyle();
    src2ndrowFinalCellStyle.setFillForegroundColor(HSSFColor.LIGHT_GREEN.index);
    src2ndrowFinalCellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
    src2ndrowFinalCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    src2ndrowFinalCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    src2ndrowFinalCellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    src2ndrowFinalCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    src2ndrowFinalCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    src2ndrowFinalCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    src2ndrowFinalCellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
    src2ndrowFinalCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    src2ndrowFinalCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    src2ndrowFinalCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    src2ndrowFinalCellStyle.setFont(blackFont);

    src2ndrowFinalCellStyle.setWrapText(false);

    /**
     * First Merged Cell Style
     */
    firstMergedCellStyle = myWorkbook.createCellStyle();
    firstMergedCellStyle.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
    firstMergedCellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
    firstMergedCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    firstMergedCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    firstMergedCellStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
    firstMergedCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    firstMergedCellStyle.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
    firstMergedCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    firstMergedCellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
    firstMergedCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    firstMergedCellStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
    firstMergedCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    firstMergedCellStyle.setFont(blackFont);

    firstMergedCellStyle.setWrapText(false);

    /**
     * summary Cell Style
     * 
     */
    summaryCellStyle = myWorkbook.createCellStyle();
    summaryCellStyle.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
    summaryCellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
    // summaryCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    summaryCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    summaryCellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    summaryCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    summaryCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    summaryCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    summaryCellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
    summaryCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    summaryCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    summaryCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    summaryCellStyle.setFont(summaryFont);

    summaryCellStyle.setWrapText(false);

    /**
     * Second Merged Cell Style
     */
    secondMergedCellStyle = myWorkbook.createCellStyle();
    secondMergedCellStyle.setFillForegroundColor(HSSFColor.ROSE.index);
    secondMergedCellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
    secondMergedCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    secondMergedCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    secondMergedCellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    secondMergedCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    secondMergedCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    secondMergedCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    secondMergedCellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
    secondMergedCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    secondMergedCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    secondMergedCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    secondMergedCellStyle.setFont(blackFont);

    secondMergedCellStyle.setWrapText(false);

    /**
     * Border Med Right Cell Style
     */
    BMRStyle = myWorkbook.createCellStyle();
    BMRStyle.setAlignment(HSSFCellStyle.ALIGN_LEFT);
    BMRStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    BMRStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
    BMRStyle.setRightBorderColor(HSSFColor.BLACK.index);

    BMRStyle.setWrapText(true);

    /**
     * Regular Cell Style
     */
    regularStyle = myWorkbook.createCellStyle();
    regularStyle.setAlignment(HSSFCellStyle.ALIGN_LEFT);
    regularStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    regularStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    regularStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    regularStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    regularStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    regularStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
    regularStyle.setRightBorderColor(HSSFColor.BLACK.index);

    regularStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    regularStyle.setTopBorderColor(HSSFColor.BLACK.index);

    regularStyle.setWrapText(true);

    /**
     * componentCellStyle Cell Style
     */
    componentCellStyle = myWorkbook.createCellStyle();
    // componentCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    componentCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    componentCellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    componentCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    componentCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    componentCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    componentCellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
    componentCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    componentCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    componentCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    componentCellStyle.setFont(blackFont);

    componentCellStyle.setWrapText(true);

    /**
     * greyCellStyle Cell Style
     */
    greyCellStyle = myWorkbook.createCellStyle();
    greyCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    greyCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    greyCellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    greyCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    greyCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    greyCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    greyCellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
    greyCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    greyCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    greyCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    greyCellStyle.setFont(greyFont);

    greyCellStyle.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
    greyCellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);

    greyCellStyle.setWrapText(false);

    /**
     * LROpenCellStyle Cell Style
     */
    LROpenCellStyle = myWorkbook.createCellStyle();
    // LROpenCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    LROpenCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    LROpenCellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    LROpenCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    // LROpenCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    // LROpenCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    // LROpenCellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
    // LROpenCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    LROpenCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    LROpenCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    LROpenCellStyle.setWrapText(true);

    /**
     * TLROpenCellStyle Cell Style
     */
    TLROpenCellStyle = myWorkbook.createCellStyle();
    // TLROpenCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    TLROpenCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    TLROpenCellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    TLROpenCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    // TLROpenCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    // TLROpenCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    // TLROpenCellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
    // TLROpenCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    TLROpenCellStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
    TLROpenCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    TLROpenCellStyle.setWrapText(true);

    /**
     * BLROpenCellStyle Cell Style
     */
    BLROpenCellStyle = myWorkbook.createCellStyle();
    // LROpenCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    BLROpenCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    BLROpenCellStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
    BLROpenCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    // BLROpenCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    // BLROpenCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    // BLROpenCellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
    // BLROpenCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    BLROpenCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    BLROpenCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    BLROpenCellStyle.setWrapText(true);

    /**
     * leftOpenCellStyle Cell Style
     */
    leftOpenCellStyle = myWorkbook.createCellStyle();
    leftOpenCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    leftOpenCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    leftOpenCellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    leftOpenCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    // leftOpenCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    // leftOpenCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    leftOpenCellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
    leftOpenCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    leftOpenCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    leftOpenCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    leftOpenCellStyle.setWrapText(true);

    /**
     * TleftOpenCellStyle Cell Style
     */
    TleftOpenCellStyle = myWorkbook.createCellStyle();
    TleftOpenCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    TleftOpenCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    TleftOpenCellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    TleftOpenCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    // TleftOpenCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    // TleftOpenCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    TleftOpenCellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
    TleftOpenCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    TleftOpenCellStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
    TleftOpenCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    TleftOpenCellStyle.setWrapText(true);

    /**
     * BLeftOpenCellStyle Cell Style
     */
    BLeftOpenCellStyle = myWorkbook.createCellStyle();
    BLeftOpenCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    leftOpenCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    BLeftOpenCellStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
    BLeftOpenCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    // BLeftOpenCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    // BLeftOpenCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    BLeftOpenCellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
    BLeftOpenCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    BLeftOpenCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    BLeftOpenCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    BLeftOpenCellStyle.setWrapText(true);

    /**
     * leftOpenMediumRightCellStyle Cell Style
     */
    leftOpenMediumRightCellStyle = myWorkbook.createCellStyle();
    leftOpenMediumRightCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    leftOpenMediumRightCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    leftOpenMediumRightCellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    leftOpenMediumRightCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    // leftOpenMediumRightCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    // leftOpenMediumRightCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    leftOpenMediumRightCellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
    leftOpenMediumRightCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    leftOpenMediumRightCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    leftOpenMediumRightCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    leftOpenMediumRightCellStyle.setWrapText(true);

    /**
     * TleftOpenMediumRightCellStyle Cell Style
     */
    TleftOpenMediumRightCellStyle = myWorkbook.createCellStyle();
    TleftOpenMediumRightCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    TleftOpenMediumRightCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    TleftOpenMediumRightCellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    TleftOpenMediumRightCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    // TleftOpenMediumRightCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    // TleftOpenMediumRightCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    TleftOpenMediumRightCellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
    TleftOpenMediumRightCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    TleftOpenMediumRightCellStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
    TleftOpenMediumRightCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    TleftOpenMediumRightCellStyle.setWrapText(true);

    /**
     * BLeftOpenMediumRightCellStyle Cell Style
     */
    BLeftOpenMediumRightCellStyle = myWorkbook.createCellStyle();
    BLeftOpenMediumRightCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    BLeftOpenMediumRightCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    BLeftOpenMediumRightCellStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
    BLeftOpenMediumRightCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    // BLeftOpenMediumRightCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    // BLeftOpenMediumRightCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    BLeftOpenMediumRightCellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
    BLeftOpenMediumRightCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    BLeftOpenMediumRightCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    BLeftOpenMediumRightCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    BLeftOpenMediumRightCellStyle.setWrapText(true);

    /**
     * rightOpenCellStyle Cell Style
     */
    rightOpenCellStyle = myWorkbook.createCellStyle();
    // rightOpenCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    rightOpenCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    rightOpenCellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    rightOpenCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    rightOpenCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    rightOpenCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    // rightOpenCellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
    // rightOpenCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    rightOpenCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    rightOpenCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    rightOpenCellStyle.setWrapText(true);

    /**
     * TrightOpenCellStyle Cell Style
     */
    TrightOpenCellStyle = myWorkbook.createCellStyle();
    // TrightOpenCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    TrightOpenCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    TrightOpenCellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    TrightOpenCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    TrightOpenCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    TrightOpenCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    // TrightOpenCellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
    // TrightOpenCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    TrightOpenCellStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
    TrightOpenCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    TrightOpenCellStyle.setWrapText(true);

    /**
     * BRightOpenCellStyle Cell Style
     */
    BRightOpenCellStyle = myWorkbook.createCellStyle();
    BRightOpenCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    BRightOpenCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    BRightOpenCellStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
    BRightOpenCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    BRightOpenCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    BRightOpenCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    // BRightOpenCellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
    // BRightOpenCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    BRightOpenCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    BRightOpenCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    BRightOpenCellStyle.setWrapText(true);

    /**
     * dateCellStyle Cell Style
     */
    dateCellStyle = myWorkbook.createCellStyle();
    // dateCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    dateCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    dateCellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    dateCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    dateCellStyle.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
    dateCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    // dateCellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
    // dateCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    dateCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    dateCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    dateCellStyle.setFont(blackFont);

    dateCellStyle.setWrapText(false);

    /**
     * exampleCellStyle Cell Style
     */
    exampleCellStyle = myWorkbook.createCellStyle();
    exampleCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    exampleCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    exampleCellStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
    exampleCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    exampleCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    exampleCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    exampleCellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
    exampleCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    // exampleCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    // exampleCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    exampleCellStyle.setFont(exampleFont);

    exampleCellStyle.setWrapText(true);

    /**
     * exb Cell Style
     */
    exbCellStyle = myWorkbook.createCellStyle();
    exbCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    exbCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    exbCellStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
    exbCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    // exbCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    // exbCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    exbCellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
    exbCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    // exampleCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    // exampleCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    exbCellStyle.setFont(exampleFont);

    exbCellStyle.setWrapText(false);

    /**
     * projectInformationCellStyle Cell Style
     */
    projectInformationCellStyle = myWorkbook.createCellStyle();
    // projectInformationCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    // projectInformationCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    projectInformationCellStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
    projectInformationCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    // projectInformationCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    // projectInformationCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    // projectInformationCellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
    // projectInformationCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    // projectInformationCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    // projectInformationCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    projectInformationCellStyle.setFont(projectInformationFont);

    projectInformationCellStyle.setWrapText(false);

    /**
     * CHCellStyle Cell Style
     */
    CHCellStyle = myWorkbook.createCellStyle();
    // CHCellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    CHCellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

    // CHCellStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
    // CHCellStyle.setBottomBorderColor(HSSFColor.BLACK.index);

    // CHCellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    // CHCellStyle.setLeftBorderColor(HSSFColor.BLACK.index);

    // CHCellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
    // CHCellStyle.setRightBorderColor(HSSFColor.BLACK.index);

    // CHCellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    // CHCellStyle.setTopBorderColor(HSSFColor.BLACK.index);

    CHCellStyle.setFont(projectInformationFont);

    CHCellStyle.setWrapText(false);

    /**
     * Set font for style
     */
    regularStyle.setFont(blackFont);

}

From source file:learning.fisshplate.LearningPoiTest.java

License:Apache License

/**
 * ??//  w  w  w  .j a  v  a 2  s  . co  m
 *
 * @throws Exception
 */
public void testInithialize() throws Exception {
    String filePath = "src/test/resources/LearningPOITest.xls";
    HSSFWorkbook input = setupInputWorkbook(filePath);
    HSSFSheet inputSheet = input.getSheetAt(0);

    for (int rowNo = 0; rowNo <= inputSheet.getLastRowNum(); rowNo++) {
        HSSFRow row = inputSheet.getRow(rowNo);
        if (row == null) {
            continue;
        }
        for (int columnNo = 0; columnNo <= row.getLastCellNum(); columnNo++) {
            HSSFCell cell = row.getCell(columnNo);
            if (cell == null) {
                continue;
            }
            HSSFRichTextString richText = new HSSFRichTextString(null);
            cell.setCellValue(richText);
            HSSFCellStyle style = input.createCellStyle();
            style.setFillPattern(HSSFCellStyle.NO_FILL);
            cell.setCellStyle(style);
        }
    }

    FileOutputStream fos = new FileOutputStream("target/outLearningTest.xls");
    input.write(fos);
    fos.close();
}

From source file:LogBeanConsultas.BeanConsultaRad.java

public void postProcessXLS(Object document) {
    HSSFWorkbook wb = (HSSFWorkbook) document;
    HSSFSheet sheet = wb.getSheetAt(0);/* w  w w . jav a 2  s . c o m*/
    HSSFRow header = sheet.getRow(0);

    HSSFCellStyle cellStyle = wb.createCellStyle();
    cellStyle.setFillForegroundColor(HSSFColor.AQUA.index);
    cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);

    for (int i = 0; i < header.getPhysicalNumberOfCells(); i++) {
        HSSFCell cell = header.getCell(i);

        cell.setCellStyle(cellStyle);
    }
}