Example usage for org.apache.poi.ss.usermodel CellStyle setBorderTop

List of usage examples for org.apache.poi.ss.usermodel CellStyle setBorderTop

Introduction

In this page you can find the example usage for org.apache.poi.ss.usermodel CellStyle setBorderTop.

Prototype

void setBorderTop(BorderStyle border);

Source Link

Document

set the type of border to use for the top border of the cell

Usage

From source file:com.crimelab.service.MedicoLegalServiceImpl.java

@Override
public Workbook createMedicoMonthly(HttpSession session, String month) {
    Workbook wb = null;//from  w  ww. ja  v  a2s. c o m

    try {
        InputStream inp = session.getServletContext()
                .getResourceAsStream("/WEB-INF/templates/MedicoMonthly.xls");
        wb = WorkbookFactory.create(inp);
        Sheet sheet = wb.getSheetAt(0);
        CellStyle cs1 = wb.createCellStyle();
        CellStyle cs2 = wb.createCellStyle();
        CellStyle bl = wb.createCellStyle();
        CellStyle br = wb.createCellStyle();
        CellStyle bt = wb.createCellStyle();
        CellStyle bb = wb.createCellStyle();
        cs1.setWrapText(true);
        cs2.setAlignment(ALIGN_CENTER);
        bt.setBorderTop(BORDER_THIN);
        bb.setBorderBottom(BORDER_THIN);
        bl.setBorderLeft(BORDER_THIN);
        br.setBorderRight(BORDER_THIN);

        Row intro1 = sheet.createRow(9);
        Cell in1 = intro1.createCell(0);
        in1.setCellValue("Period Covered:");
        in1.setCellStyle(cs1);
        in1.setCellStyle(cs2);

        Row intro2 = sheet.createRow(10);
        Cell in2 = intro2.createCell(0);
        in1.setCellValue(month.split("-")[0]);
        in1.setCellStyle(cs1);
        in1.setCellStyle(cs2);

        int ctr = 12; //initial
        Row row = sheet.createRow(ctr);
        month = month.split("-")[1];

        //JOptionPane.showMessageDialog(null, medicoLegalDAO.getAllMedicoLegal(month));
        for (MedicoLegal medicoLegal : medicoLegalDAO.getAllMedicoLegal(month)) {
            //JOptionPane.showMessageDialog(null, medicoLegal.getReportNo());
            Cell cell0 = row.createCell(0);
            cell0.setCellValue(medicoLegal.getCaseNo());
            cell0.setCellStyle(bt);
            cell0.setCellStyle(bb);
            cell0.setCellStyle(bl);
            cell0.setCellStyle(br);

            Cell cell1 = row.createCell(1);//.setCellValue(medicoLegal.getReportNo());
            cell1.setCellValue(medicoLegal.getExaminerName());
            cell1.setCellStyle(bt);
            cell1.setCellStyle(bb);
            cell1.setCellStyle(bl);
            cell1.setCellStyle(br);

            Cell cell2 = row.createCell(2);//.setCellValue(medicoLegal.getRequestingParty());
            cell2.setCellValue(medicoLegal.getCaseType());
            cell2.setCellStyle(bt);
            cell2.setCellStyle(bb);
            cell2.setCellStyle(bl);
            cell2.setCellStyle(br);

            Cell cell3 = row.createCell(3);//.setCellValue(medicoLegal.getDescriptionOfEvidence());
            cell3.setCellValue(medicoLegal.getVictim());
            cell2.setCellStyle(bt);
            cell2.setCellStyle(bb);
            cell3.setCellStyle(bl);
            cell3.setCellStyle(br);

            Cell cell4 = row.createCell(4);//.setCellValue(medicoLegal.getSpecimenWeight());
            cell4.setCellValue(medicoLegal.getSuspect());
            cell4.setCellStyle(bt);
            cell4.setCellStyle(bb);
            cell4.setCellStyle(bl);
            cell4.setCellStyle(br);

            Cell cell5 = row.createCell(5);//.setCellValue(medicoLegal.getCustody());
            cell5.setCellValue(medicoLegal.getTimeDateReceived());
            cell5.setCellStyle(bt);
            cell5.setCellStyle(bb);
            cell5.setCellStyle(bl);
            cell5.setCellStyle(br);

            Cell cell6 = row.createCell(6);//.setCellValue(medicoLegal.getSuspects());
            cell6.setCellValue(medicoLegal.getFindings());
            cell6.setCellStyle(bt);
            cell6.setCellStyle(bb);
            cell6.setCellStyle(bl);
            cell6.setCellStyle(br);

            row = sheet.createRow(ctr += 1);

            return wb;
        }

    } catch (Exception e) {
        e.printStackTrace();
    }
    return wb;
}

From source file:com.emi.loan.util.Utilities.java

public static void exportTOExcel(DefaultTableModel dtm, Map<String, String> ln_info) {
    FileOutputStream out = null;//from   w  w w  .j  a v a  2 s.c o  m
    try {
        Workbook wb = new HSSFWorkbook();
        //            CreationHelper createhelper = wb.getCreationHelper();
        Sheet sheet = wb.createSheet("EMI TABLE");
        Row row;
        Cell cell;
        File file = chooseFile();
        out = new FileOutputStream(file);

        HSSFFont headerFont = (HSSFFont) wb.createFont();
        headerFont.setFontHeightInPoints((short) 12);
        headerFont.setFontName("CENTURY GOTHIC");
        headerFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
        headerFont.setColor(HSSFColor.WHITE.index);

        HSSFFont infoFont = (HSSFFont) wb.createFont();
        infoFont.setFontHeightInPoints((short) 14);
        infoFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);

        //            HSSFFont font = (HSSFFont) wb.createFont();
        //            font.setFontHeightInPoints((short) 10);
        //            font.setFontName("CENTURY GOTHIC");
        //            font.setColor(HSSFColor.BLACK.index);
        CellStyle defaultStyle = wb.createCellStyle();
        defaultStyle.setFillForegroundColor(HSSFColor.AQUA.index);
        defaultStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
        defaultStyle.setAlignment(HSSFCellStyle.ALIGN_JUSTIFY);
        defaultStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_JUSTIFY);
        defaultStyle.setFont(headerFont);

        CellStyle borderStyle = wb.createCellStyle();
        borderStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
        borderStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
        borderStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
        borderStyle.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
        borderStyle.setFont(infoFont);

        row = sheet.createRow(1);
        cell = row.createCell(0);
        cell.setCellStyle(defaultStyle);
        cell.setCellValue("Loan Amount(Rs.)");

        cell = row.createCell(1);
        cell.setCellStyle(borderStyle);
        cell.setCellValue(Double.parseDouble(ln_info.get("Loan Amount")));

        row = sheet.createRow(3);
        cell = row.createCell(0);
        cell.setCellStyle(defaultStyle);
        cell.setCellValue("Interest %");

        cell = row.createCell(1);
        cell.setCellStyle(borderStyle);
        cell.setCellValue(Double.parseDouble(ln_info.get("Interest")));

        row = sheet.createRow(5);
        cell = row.createCell(0);
        cell.setCellStyle(defaultStyle);
        cell.setCellValue("Period (months)");

        cell = row.createCell(1);
        cell.setCellStyle(borderStyle);
        cell.setCellValue(Integer.parseInt(ln_info.get("Period")));

        for (int i = 0; i <= dtm.getRowCount(); i++) {

            row = sheet.createRow(i + 8);
            for (int j = 0; j < dtm.getColumnCount(); j++) {
                cell = row.createCell(j);

                if (i == 0) { // writing the column headers 

                    cell.setCellStyle(defaultStyle);
                    cell.setCellValue(dtm.getColumnName(j));

                } else if (j == 0 || j == 5) {
                    cell.setCellValue(Integer.parseInt(dtm.getValueAt(i - 1, j).toString()));
                } else {
                    cell.setCellValue(Double.parseDouble(dtm.getValueAt(i - 1, j).toString()));
                }

            }
        }

        row = sheet.createRow(dtm.getRowCount() + 12);
        cell = row.createCell(0);
        cell.setCellValue("-- END OF REPORT --");

        for (int j = 0; j < dtm.getColumnCount(); j++) {
            sheet.autoSizeColumn(j, true);
        }
        wb.write(out);
    } catch (FileNotFoundException ex) {
        System.out.println("File not Found");
        Logger.getLogger(Utilities.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
        System.out.println("IOException");
        Logger.getLogger(Utilities.class.getName()).log(Level.SEVERE, null, ex);
    } finally {
        try {
            out.close();
        } catch (IOException ex) {
            Logger.getLogger(Utilities.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}

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

License:Common Public License

protected CellStyle createHeaderCellStyle() {
    CellStyle style = workbook.createCellStyle();

    Font font = workbook.createFont();

    font.setFontName(fontFamily);//from w w  w.j a va 2 s  .co  m
    font.setFontHeightInPoints((short) fontSize);
    font.setBoldweight(Font.BOLDWEIGHT_BOLD);

    style.setFont(font);
    style.setAlignment(CellStyle.ALIGN_LEFT);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);

    switch (format) {
    case XSSF:
    case SXSSF:
        ((XSSFCellStyle) style).setFillForegroundColor(new XSSFColor(Color.lightGray));
        break;
    case HSSF:
        style.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
        break;
    default:
        assert false;
    }

    style.setFillPattern(CellStyle.SOLID_FOREGROUND);
    style.setBorderTop(CellStyle.BORDER_THIN);
    style.setBorderLeft(CellStyle.BORDER_THIN);
    style.setBorderRight(CellStyle.BORDER_THIN);
    style.setBorderBottom(CellStyle.BORDER_THIN);

    return style;
}

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

License:Common Public License

protected CellStyle createValueCellStyle() {
    CellStyle style = workbook.createCellStyle();
    Font font = workbook.createFont();

    font.setFontName(fontFamily);/*from www.  j  a v a2s. co  m*/
    font.setFontHeightInPoints((short) fontSize);
    font.setBoldweight(Font.BOLDWEIGHT_NORMAL);

    style.setFont(font);
    style.setAlignment(CellStyle.ALIGN_RIGHT);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    style.setBorderTop(CellStyle.BORDER_THIN);
    style.setBorderLeft(CellStyle.BORDER_THIN);
    style.setBorderRight(CellStyle.BORDER_THIN);
    style.setBorderBottom(CellStyle.BORDER_THIN);
    style.setDataFormat((short) 4);

    return style;
}

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

License:Common Public License

protected CellStyle createAggregationCellStyle() {
    CellStyle style = workbook.createCellStyle();
    Font font = workbook.createFont();

    font.setFontName(fontFamily);/*from w  w  w. j a  va 2s  . c  o  m*/
    font.setFontHeightInPoints((short) fontSize);
    font.setBoldweight(Font.BOLDWEIGHT_NORMAL);

    style.setFont(font);
    style.setAlignment(CellStyle.ALIGN_RIGHT);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);

    switch (format) {
    case XSSF:
    case SXSSF:
        ((XSSFCellStyle) style).setFillForegroundColor(new XSSFColor(Color.lightGray));
        break;
    case HSSF:
        style.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
        break;
    default:
        assert false;
    }

    style.setFillPattern(CellStyle.SOLID_FOREGROUND);
    style.setBorderTop(CellStyle.BORDER_THIN);
    style.setBorderLeft(CellStyle.BORDER_THIN);
    style.setBorderRight(CellStyle.BORDER_THIN);
    style.setBorderBottom(CellStyle.BORDER_THIN);
    style.setDataFormat((short) 4);

    return style;
}

From source file:com.fengduo.spark.commons.file.excel.ExportExcel.java

License:Open Source License

/**
 * ?//from   w w  w  .j  av  a2 s.  c  om
 * 
 * @param wb 
 * @return ?
 */
private Map<String, CellStyle> createStyles(Workbook wb) {
    Map<String, CellStyle> styles = new HashMap<String, CellStyle>();

    CellStyle style = wb.createCellStyle();
    style.setAlignment(CellStyle.ALIGN_CENTER);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    Font titleFont = wb.createFont();
    titleFont.setFontName("Arial");
    titleFont.setFontHeightInPoints((short) 16);
    titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    style.setFont(titleFont);
    styles.put("title", style);

    style = wb.createCellStyle();
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    style.setBorderRight(CellStyle.BORDER_THIN);
    style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
    style.setBorderLeft(CellStyle.BORDER_THIN);
    style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
    style.setBorderTop(CellStyle.BORDER_THIN);
    style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
    style.setBorderBottom(CellStyle.BORDER_THIN);
    style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
    Font dataFont = wb.createFont();
    dataFont.setFontName("Arial");
    dataFont.setFontHeightInPoints((short) 10);
    style.setFont(dataFont);
    styles.put("data", style);

    style = wb.createCellStyle();
    style.cloneStyleFrom(styles.get("data"));
    style.setAlignment(CellStyle.ALIGN_LEFT);
    styles.put("data1", style);

    style = wb.createCellStyle();
    style.cloneStyleFrom(styles.get("data"));
    style.setAlignment(CellStyle.ALIGN_CENTER);
    styles.put("data2", style);

    style = wb.createCellStyle();
    style.cloneStyleFrom(styles.get("data"));
    style.setAlignment(CellStyle.ALIGN_RIGHT);
    styles.put("data3", style);

    style = wb.createCellStyle();
    style.cloneStyleFrom(styles.get("data"));
    // style.setWrapText(true);
    style.setAlignment(CellStyle.ALIGN_CENTER);
    style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
    style.setFillPattern(CellStyle.SOLID_FOREGROUND);
    Font headerFont = wb.createFont();
    headerFont.setFontName("Arial");
    headerFont.setFontHeightInPoints((short) 10);
    headerFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    headerFont.setColor(IndexedColors.WHITE.getIndex());
    style.setFont(headerFont);
    styles.put("header", style);

    return styles;
}

From source file:com.ferid.app.classroom.utility.ExcelStyleManager.java

License:Apache License

/**
 * Header cell style (dates)//from  w w w.ja  va2  s . c o m
 * @param wb Workbook
 * @return CellStyle
 */
public static CellStyle getHeaderCellStyle(Workbook wb) {
    CellStyle cellStyle = wb.createCellStyle();

    cellStyle.setAlignment(HorizontalAlignment.CENTER);

    Font font = wb.createFont();
    font.setFontHeightInPoints((short) 8);
    font.setBold(true);
    cellStyle.setFont(font);

    cellStyle.setWrapText(true);

    cellStyle.setFillForegroundColor(IndexedColors.LIGHT_TURQUOISE.getIndex());
    cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);

    cellStyle.setBorderRight(BorderStyle.THIN);
    cellStyle.setRightBorderColor(IndexedColors.BLACK.getIndex());
    cellStyle.setBorderBottom(BorderStyle.THIN);
    cellStyle.setBottomBorderColor(IndexedColors.BLACK.getIndex());
    cellStyle.setBorderLeft(BorderStyle.THIN);
    cellStyle.setLeftBorderColor(IndexedColors.BLACK.getIndex());
    cellStyle.setBorderTop(BorderStyle.THIN);
    cellStyle.setTopBorderColor(IndexedColors.BLACK.getIndex());

    return cellStyle;
}

From source file:com.ferid.app.classroom.utility.ExcelStyleManager.java

License:Apache License

/**
 * Content cell style (presence)/*from w  w  w  .j ava  2 s. c o  m*/
 * @param wb Workbook
 * @return CellStyle
 */
public static CellStyle getContentCellStyle(Workbook wb) {
    CellStyle cellStyle = wb.createCellStyle();

    cellStyle.setAlignment(HorizontalAlignment.CENTER);

    Font font = wb.createFont();
    font.setFontHeightInPoints((short) 8);
    cellStyle.setFont(font);

    cellStyle.setWrapText(true);

    cellStyle.setFillForegroundColor(IndexedColors.LIGHT_YELLOW.getIndex());
    cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);

    cellStyle.setBorderRight(BorderStyle.THIN);
    cellStyle.setRightBorderColor(IndexedColors.BLACK.getIndex());
    cellStyle.setBorderBottom(BorderStyle.THIN);
    cellStyle.setBottomBorderColor(IndexedColors.BLACK.getIndex());
    cellStyle.setBorderLeft(BorderStyle.THIN);
    cellStyle.setLeftBorderColor(IndexedColors.BLACK.getIndex());
    cellStyle.setBorderTop(BorderStyle.THIN);
    cellStyle.setTopBorderColor(IndexedColors.BLACK.getIndex());

    return cellStyle;
}

From source file:com.firstonesoft.poi.TimesheetDemo.java

License:Apache License

/**
 * Create a library of cell styles//from   w w  w  . j  a  va 2s .co  m
 */
private static Map<String, CellStyle> createStyles(Workbook wb) {
    Map<String, CellStyle> styles = new HashMap<String, CellStyle>();

    CellStyle style;

    Font titleFont = wb.createFont();
    titleFont.setFontHeightInPoints((short) 18);
    titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    style = wb.createCellStyle();
    style.setAlignment(CellStyle.ALIGN_CENTER);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    style.setFont(titleFont);
    styles.put("title", style);

    Font monthFont = wb.createFont();
    monthFont.setFontHeightInPoints((short) 11);
    monthFont.setColor(IndexedColors.WHITE.getIndex());
    style = wb.createCellStyle();
    style.setAlignment(CellStyle.ALIGN_CENTER);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
    style.setFillPattern(CellStyle.SOLID_FOREGROUND);
    style.setFont(monthFont);
    style.setWrapText(true);
    styles.put("header", style);

    style = wb.createCellStyle();
    style.setAlignment(CellStyle.ALIGN_CENTER);
    style.setWrapText(true);
    style.setBorderRight(CellStyle.BORDER_THIN);
    style.setRightBorderColor(IndexedColors.BLACK.getIndex());
    style.setBorderLeft(CellStyle.BORDER_THIN);
    style.setLeftBorderColor(IndexedColors.BLACK.getIndex());
    style.setBorderTop(CellStyle.BORDER_THIN);
    style.setTopBorderColor(IndexedColors.BLACK.getIndex());
    style.setBorderBottom(CellStyle.BORDER_THIN);
    style.setBottomBorderColor(IndexedColors.BLACK.getIndex());
    styles.put("cell", style);

    style = wb.createCellStyle();
    style.setAlignment(CellStyle.ALIGN_CENTER);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
    style.setFillPattern(CellStyle.SOLID_FOREGROUND);
    style.setDataFormat(wb.createDataFormat().getFormat("0.00"));
    styles.put("formula", style);

    style = wb.createCellStyle();
    style.setAlignment(CellStyle.ALIGN_CENTER);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    style.setFillForegroundColor(IndexedColors.GREY_40_PERCENT.getIndex());
    style.setFillPattern(CellStyle.SOLID_FOREGROUND);
    style.setDataFormat(wb.createDataFormat().getFormat("0.00"));
    styles.put("formula_2", style);

    return styles;
}

From source file:com.funtl.framework.smoke.core.commons.excel.ExportExcel.java

License:Apache License

/**
 * ?//from   w w  w.j a va2  s  .c om
 *
 * @param wb 
 * @return ?
 */
private Map<String, CellStyle> createStyles(Workbook wb) {
    Map<String, CellStyle> styles = new HashMap<String, CellStyle>();

    CellStyle style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.CENTER);
    //      style.setAlignment(CellStyle.ALIGN_CENTER);
    style.setVerticalAlignment(VerticalAlignment.CENTER);
    //      style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    Font titleFont = wb.createFont();
    titleFont.setFontName("Arial");
    titleFont.setFontHeightInPoints((short) 16);
    titleFont.setBold(true);
    //      titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    style.setFont(titleFont);
    styles.put("title", style);

    style = wb.createCellStyle();
    style.setVerticalAlignment(VerticalAlignment.CENTER);
    //      style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    style.setBorderRight(BorderStyle.THIN);
    //      style.setBorderRight(CellStyle.BORDER_THIN);
    style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
    style.setBorderLeft(BorderStyle.THIN);
    //      style.setBorderLeft(CellStyle.BORDER_THIN);
    style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
    style.setBorderTop(BorderStyle.THIN);
    //      style.setBorderTop(CellStyle.BORDER_THIN);
    style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
    style.setBorderBottom(BorderStyle.THIN);
    //      style.setBorderBottom(CellStyle.BORDER_THIN);
    style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
    Font dataFont = wb.createFont();
    dataFont.setFontName("Arial");
    dataFont.setFontHeightInPoints((short) 10);
    style.setFont(dataFont);
    styles.put("data", style);

    style = wb.createCellStyle();
    style.cloneStyleFrom(styles.get("data"));
    style.setAlignment(HorizontalAlignment.LEFT);
    //      style.setAlignment(CellStyle.ALIGN_LEFT);
    styles.put("data1", style);

    style = wb.createCellStyle();
    style.cloneStyleFrom(styles.get("data"));
    style.setAlignment(HorizontalAlignment.CENTER);
    //      style.setAlignment(CellStyle.ALIGN_CENTER);
    styles.put("data2", style);

    style = wb.createCellStyle();
    style.cloneStyleFrom(styles.get("data"));
    style.setAlignment(HorizontalAlignment.RIGHT);
    //      style.setAlignment(CellStyle.ALIGN_RIGHT);
    styles.put("data3", style);

    style = wb.createCellStyle();
    style.cloneStyleFrom(styles.get("data"));
    //      style.setWrapText(true);
    style.setAlignment(HorizontalAlignment.CENTER);
    //      style.setAlignment(CellStyle.ALIGN_CENTER);
    style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
    style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    //      style.setFillPattern(CellStyle.SOLID_FOREGROUND);
    Font headerFont = wb.createFont();
    headerFont.setFontName("Arial");
    headerFont.setFontHeightInPoints((short) 10);
    headerFont.setBold(true);
    //      headerFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    headerFont.setColor(IndexedColors.WHITE.getIndex());
    style.setFont(headerFont);
    styles.put("header", style);

    return styles;
}