Example usage for org.apache.poi.ss.usermodel Font setFontName

List of usage examples for org.apache.poi.ss.usermodel Font setFontName

Introduction

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

Prototype


void setFontName(String name);

Source Link

Document

set the name for the font (i.e.

Usage

From source file:com.vincestyling.apkinfoextractor.core.export.ExportToExcel.java

License:Apache License

private Map<String, CellStyle> createStyles(Workbook wb) {
    Map<String, CellStyle> styles = new HashMap<>();
    String fontName = getAvaliableTitleFont();
    CellStyle style;//w  ww.j a v a 2s. c o  m

    Font font = wb.createFont();
    font.setFontName(fontName);
    font.setFontHeightInPoints((short) 14);
    font.setColor(IndexedColors.BROWN.getIndex());

    style = wb.createCellStyle();
    style.setAlignment(CellStyle.ALIGN_LEFT);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    style.setFont(font);
    styles.put("title", style);

    font = wb.createFont();
    font.setFontName(fontName);
    font.setFontHeightInPoints((short) 14);
    font.setBoldweight(Font.BOLDWEIGHT_BOLD);
    font.setColor(IndexedColors.WHITE.getIndex());

    style = wb.createCellStyle();
    style.setAlignment(CellStyle.ALIGN_CENTER);
    style.setFillPattern(CellStyle.SOLID_FOREGROUND);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
    style.setFont(font);
    style.setWrapText(true);
    setBorder(style);
    styles.put("header", style);

    font = wb.createFont();
    font.setFontName(fontName);
    font.setFontHeightInPoints((short) 12);
    font.setColor(IndexedColors.BLACK.getIndex());

    style = wb.createCellStyle();
    style.setAlignment(CellStyle.ALIGN_CENTER);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    style.setWrapText(true);
    style.setFont(font);
    setBorder(style);
    styles.put("cell", style);

    return styles;
}

From source file:com.webbfontaine.valuewebb.report.utils.cellStyles.CellStyleUtils.java

License:Open Source License

public static CellStyle cellStyle(Workbook workBook, CellType cellType) {
    CellStyle cellStyle = workBook.createCellStyle();

    if (!Color.NO_COLOR.equals(cellType.getColor())) {
        Font font = workBook.createFont();
        font.setFontName("Arial");
        font.setColor(cellType.getColor().index());
        cellStyle.setFont(font);//from   w  w  w  . ja v a 2  s.  c o  m
    }

    if (!Alignment.NO_ALIGNMENT.equals(cellType.getHorizontalAlignment())) {
        cellStyle.setAlignment(cellType.getHorizontalAlignment().index());
    }

    if (!Alignment.NO_ALIGNMENT.equals(cellType.getVerticalAlignment())) {
        cellStyle.setVerticalAlignment(cellType.getVerticalAlignment().index());
    }

    if (!Format.NO_FORMAT.equals(cellType.getFormat())) {
        CreationHelper creationHelper = workBook.getCreationHelper();
        cellStyle.setDataFormat(creationHelper.createDataFormat().getFormat(cellType.getFormat().text()));
    }

    setCellBorders(cellStyle);
    return cellStyle;
}

From source file:Compras.avanceSurtido.java

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
     // TODO add your handling code here:
     h = new Herramientas(this.user, 0);
     h.session(sessionPrograma);/*  ww w.j  av a2  s  . co m*/
     File archivoXLS = null;
     javax.swing.JFileChooser jF1 = new javax.swing.JFileChooser();
     jF1.setFileFilter(new ExtensionFileFilter("Excel document (*.xls)", new String[] { "xls" }));
     String ruta = null;
     if (jF1.showSaveDialog(null) == jF1.APPROVE_OPTION) {
         ruta = jF1.getSelectedFile().getAbsolutePath();
         if (ruta != null) {
             archivoXLS = new File(ruta + ".xls");
             try {
                 if (archivoXLS.exists())
                     archivoXLS.delete();
                 archivoXLS.createNewFile();
                 Workbook libro = new HSSFWorkbook();
                 FileOutputStream archivo = new FileOutputStream(archivoXLS);
                 Sheet hoja = libro.createSheet("Avance de pedidos");
                 Font font = libro.createFont();
                 font.setFontHeightInPoints((short) 24);
                 font.setFontName("Arial");
                 font.setItalic(false);
                 font.setBold(true);

                 // Fonts are set into a style so create a new one to use.
                 CellStyle style = libro.createCellStyle();
                 style.setFont(font);

                 Session session = HibernateUtil.getSessionFactory().openSession();
                 session.beginTransaction().begin();
                 Orden ord = (Orden) session.get(Orden.class, Integer.parseInt(orden));

                 Configuracion con = (Configuracion) session.get(Configuracion.class, 1);
                 hoja.setColumnWidth(2, 15000);
                 Row r0 = hoja.createRow(0);
                 Cell celdaTitulo = r0.createCell(0);
                 celdaTitulo.setCellValue(con.getEmpresa());
                 celdaTitulo.setCellStyle(style);

                 Row r1 = hoja.createRow(1);
                 r1.createCell(6).setCellValue("Orden de Taller:");
                 r1.createCell(7).setCellValue(orden);

                 Row r2 = hoja.createRow(2);
                 r2.createCell(0).setCellValue("Marca:");
                 r2.createCell(1).setCellValue(ord.getMarca().getMarcaNombre());
                 r2.createCell(6).setCellValue("N Serie:");
                 r2.createCell(7).setCellValue(ord.getNoSerie());

                 Row r3 = hoja.createRow(3);
                 r3.createCell(0).setCellValue("Tipo:");
                 r3.createCell(1).setCellValue(ord.getTipo().getTipoNombre());
                 r3.createCell(6).setCellValue("N Motor:");
                 r3.createCell(7).setCellValue(ord.getNoMotor());

                 Row r4 = hoja.createRow(4);
                 r4.createCell(0).setCellValue("Modelo:");
                 r4.createCell(1).setCellValue("" + ord.getModelo());

                 hoja.createRow(5).createCell(0).setCellValue(
                         "**********************************************************************************************************************************************************************************************************************************************************************************************************************************************************");

                 Row r6 = hoja.createRow(6);
                 r6.createCell(0).setCellValue("Partida");
                 r6.createCell(1).setCellValue("sub");
                 r6.createCell(2).setCellValue("Descripcion");
                 r6.createCell(3).setCellValue("Hoj");
                 r6.createCell(4).setCellValue("Mec");
                 r6.createCell(5).setCellValue("Sus");
                 r6.createCell(6).setCellValue("Ele");
                 r6.createCell(7).setCellValue("Can");
                 r6.createCell(8).setCellValue("Med");
                 r6.createCell(9).setCellValue("Folio");
                 r6.createCell(10).setCellValue("Codigo");
                 r6.createCell(11).setCellValue("Origen");
                 r6.createCell(12).setCellValue("Proveedor");
                 r6.createCell(13).setCellValue("Cant C.");
                 r6.createCell(14).setCellValue("C/U Comprado");
                 r6.createCell(15).setCellValue("Plazo");
                 r6.createCell(16).setCellValue("Pedido");
                 r6.createCell(17).setCellValue("F. Pedido");
                 r6.createCell(18).setCellValue("Entradas");
                 r6.createCell(19).setCellValue("Devoluciones");
                 r6.createCell(20).setCellValue("Pendientes");
                 r6.createCell(21).setCellValue("No Factura");

                 hoja.createRow(7).createCell(0).setCellValue(
                         "**********************************************************************************************************************************************************************************************************************************************************************************************************************************************************");

                 session.close();
                 if (t_datos.getRowCount() > 0) {
                     for (int i = 0; i < t_datos.getRowCount(); i++) {

                         Row fila = hoja.createRow(i + 8);
                         for (int j = 1; j < t_datos.getColumnCount(); j++) {
                             if (j > 3 && j < 8) {
                                 if ((boolean) t_datos.getValueAt(i, j) == true)
                                     fila.createCell(j - 1).setCellValue("");
                                 else
                                     fila.createCell(j - 1).setCellValue("");
                             } else {
                                 if (t_datos.getValueAt(i, j) != null)
                                     fila.createCell(j - 1).setCellValue("" + t_datos.getValueAt(i, j));
                                 else
                                     fila.createCell(j - 1).setCellValue("");
                             }
                         }
                     }
                 }

                 libro.write(archivo);
                 archivo.close();
                 Desktop.getDesktop().open(archivoXLS);
             } catch (Exception e) {
                 System.out.println(e);
                 e.printStackTrace();
                 JOptionPane.showMessageDialog(this,
                         "No se pudo realizar el reporte si el archivo esta abierto");
             }
         }
     }
 }

From source file:Compras.generaCotizacion.java

void exel() {
     h = new Herramientas(this.user, 0);
     h.session(sessionPrograma);//from w w  w  . j a  va2s.c  o  m
     javax.swing.JFileChooser jF1 = new javax.swing.JFileChooser();
     jF1.setFileFilter(new ExtensionFileFilter("Excel document (*.xls)", new String[] { "xls" }));
     String ruta = null;
     if (jF1.showSaveDialog(null) == jF1.APPROVE_OPTION) {
         ruta = jF1.getSelectedFile().getAbsolutePath();
         if (ruta != null) {
             if (ruta.endsWith(".xls") == true)
                 archivoXLS = new File(ruta);
             else
                 archivoXLS = new File(ruta + ".xls");
             try {
                 if (archivoXLS.exists())
                     archivoXLS.delete();
                 archivoXLS.createNewFile();
                 Workbook libro = new HSSFWorkbook();
                 FileOutputStream archivo = new FileOutputStream(archivoXLS);
                 Sheet hoja = libro.createSheet("Cotizacion");
                 Font font = libro.createFont();
                 font.setFontHeightInPoints((short) 24);
                 font.setFontName("Arial");
                 font.setItalic(false);
                 font.setBold(true);

                 Font font10 = libro.createFont();
                 font10.setFontHeightInPoints((short) 10);
                 font10.setFontName("Arial");
                 font10.setItalic(false);
                 font10.setBold(false);
                 font10.setColor(new HSSFColor.YELLOW().getIndex());

                 Font font11 = libro.createFont();
                 font11.setFontHeightInPoints((short) 10);
                 font11.setFontName("Arial");
                 font10.setItalic(false);
                 font10.setBold(false);
                 font11.setColor(new HSSFColor.BLACK().getIndex());

                 // Fonts are set into a style so create a new one to use.
                 CellStyle style = libro.createCellStyle();
                 CellStyle desBloqueo = libro.createCellStyle();
                 CellStyle desBloqueo1 = libro.createCellStyle();
                 CellStyle desBloqueoFecha = libro.createCellStyle();

                 style.setFont(font);

                 desBloqueo.setFont(font10);
                 desBloqueo.setLocked(false);
                 desBloqueo.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
                 desBloqueo.setFillBackgroundColor(new HSSFColor.GREEN().getIndex());

                 desBloqueo1.setFont(font11);
                 desBloqueo1.setLocked(false);
                 desBloqueo1.setFillBackgroundColor(new HSSFColor.WHITE().getIndex());

                 desBloqueoFecha.setFont(font10);
                 desBloqueoFecha.setLocked(false);
                 desBloqueoFecha.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
                 desBloqueoFecha.setFillBackgroundColor(new HSSFColor.GREEN().getIndex());
                 desBloqueoFecha.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d/yy"));

                 Session session = HibernateUtil.getSessionFactory().openSession();
                 session.beginTransaction().begin();
                 Orden ord = (Orden) session.get(Orden.class, Integer.parseInt(orden));
                 Configuracion con = (Configuracion) session.get(Configuracion.class, 1);

                 hoja.setColumnWidth(5, 15000);
                 Row r0 = hoja.createRow(0);
                 Cell celdaTitulo = r0.createCell(0);
                 celdaTitulo.setCellValue(con.getEmpresa());
                 celdaTitulo.setCellStyle(style);

                 Row r1 = hoja.createRow(1);
                 r1.createCell(6).setCellValue("Orden de Taller:");
                 r1.createCell(7).setCellValue(orden);

                 Row r2 = hoja.createRow(2);
                 r2.createCell(0).setCellValue("Marca:");
                 r2.createCell(1).setCellValue(ord.getMarca().getMarcaNombre());
                 r2.createCell(6).setCellValue("N Serie:");
                 r2.createCell(7).setCellValue(ord.getNoSerie());

                 Row r3 = hoja.createRow(3);
                 r3.createCell(0).setCellValue("Tipo:");
                 r3.createCell(1).setCellValue(ord.getTipo().getTipoNombre());
                 r3.createCell(6).setCellValue("N Motor:");
                 r3.createCell(7).setCellValue(ord.getNoMotor());

                 Row r4 = hoja.createRow(4);
                 r4.createCell(0).setCellValue("NP:");
                 r4.createCell(1).setCellValue(t_datos1.getValueAt(t_datos1.getSelectedRow(), 1).toString());
                 r4.createCell(2).setCellValue("Proveedor:");
                 r4.createCell(3).setCellValue(t_datos1.getValueAt(t_datos1.getSelectedRow(), 2).toString());
                 r4.createCell(6).setCellValue("Modelo:");
                 r4.createCell(7).setCellValue("" + ord.getModelo());

                 Row r5 = hoja.createRow(5);
                 r5.createCell(0).setCellValue(
                         "**********************************************************************************[Nota:  Solo puedes editar las celdas de color]*******************************************************************************");

                 Row r6 = hoja.createRow(6);
                 r6.createCell(0).setCellValue("Partida");
                 r6.createCell(1).setCellValue("sub");
                 r6.createCell(2).setCellValue("Cantidad");
                 r6.createCell(3).setCellValue("U/Medida");
                 r6.createCell(4).setCellValue("N Parte");
                 r6.createCell(5).setCellValue("Descripcion");
                 r6.createCell(6).setCellValue("Instruccin");
                 r6.createCell(7).setCellValue("Precio c/u");
                 r6.createCell(8).setCellValue("T o t a l");
                 r6.createCell(9).setCellValue("Origen");
                 r6.createCell(10).setCellValue("Pazo");

                 Row r7 = hoja.createRow(7);
                 r7.createCell(0).setCellValue(
                         "**********************************************************************************************************************************************************************************************************************");

                 List misCotizaciones = null;

                 Query query = session.createQuery("SELECT DISTINCT par FROM Partida par "
                         + "RIGHT JOIN FETCH par.partidaCotizacions partC " + "RIGHT JOIN partC.cotizacion cot "
                         + "where cot.idCotizacion="
                         + t_datos1.getValueAt(t_datos1.getSelectedRow(), 0).toString()
                         + " order by par.idEvaluacion asc, par.subPartida asc");
                 //misCotizaciones=c.addOrder(Order.asc("idCotizacion")).list();
                 misCotizaciones = query.list();

                 if (misCotizaciones.size() > 0) {

                     for (int i = 0; i < misCotizaciones.size(); i++) {
                         Partida Part = (Partida) misCotizaciones.get(i);
                         Row fila = hoja.createRow(i + 8);

                         fila.createCell(0).setCellValue(Part.getIdEvaluacion());
                         fila.createCell(1).setCellValue(Part.getSubPartida());
                         fila.createCell(2).setCellValue(Part.getCant());
                         fila.createCell(3).setCellValue(Part.getMed());

                         Cell aux = fila.createCell(4);
                         aux.setCellStyle(desBloqueo);
                         if (Part.getEjemplar() != null)
                             aux.setCellValue(Part.getEjemplar().getIdParte());
                         else
                             aux.setCellValue("");

                         fila.createCell(5).setCellValue(Part.getCatalogo().getNombre());
                         int fil = i + 9;
                         Cell a10 = fila.createCell(6);
                         a10.setCellStyle(desBloqueo1);
                         a10.setCellValue(Part.getInstruccion());

                         Cell a6 = fila.createCell(7);
                         a6.setCellStyle(desBloqueo);
                         a6.setCellValue("");
                         Cell celForm = fila.createCell(8);
                         celForm.setCellType(HSSFCell.CELL_TYPE_FORMULA);
                         celForm.setCellFormula("H" + fil + "*C" + fil);

                         if (Part.isOri() == true)
                             fila.createCell(9).setCellValue("Ori");
                         else if (Part.isNal() == true)
                             fila.createCell(9).setCellValue("Nal");
                         else if (Part.isDesm() == true)
                             fila.createCell(9).setCellValue("Des");
                         else
                             fila.createCell(9).setCellValue("");
                         Cell a9 = fila.createCell(10);
                         a9.setCellValue("");
                         a9.setCellStyle(desBloqueo);
                     }
                 }

                 hoja.protectSheet("04650077");
                 libro.write(archivo);
                 archivo.close();
                 Desktop.getDesktop().open(archivoXLS);
                 if (session != null)
                     if (session.isOpen())
                         session.close();
             } catch (Exception e) {
                 System.out.println(e);
                 e.printStackTrace();
                 JOptionPane.showMessageDialog(this,
                         "No se pudo realizar el reporte si el archivo esta abierto");
             }
         }
     }
 }

From source file:Controller.Sonstiges.ExcelController.java

private void makeTitleOfPage() throws IOException {

    this.sheet.addMergedRegion(new CellRangeAddress(0, 3, 0, 13));
    this.row = this.sheet.createRow(0);
    XSSFCell cell2 = this.row.createCell(0);
    String title = "Inprotuc Datenbank | Informationen zur Personen \nSuchkriterien: ";
    ArrayList<String> array2 = this.model.getQueryInfo();
    ArrayList<String> array = this.deleteEmptyValueOArray(array2);
    String info = "";
    if (array.size() == 2) {
        info = array.get(0) + " / " + array.get(1) + ".";
    }//from   ww  w  . j a  v a  2 s  .co  m
    if (array.size() == 4) {
        info = array.get(0) + "/" + array.get(1) + ", ";
        info = info + array.get(2) + "/" + array.get(3) + ".";
    }
    if (array.size() == 6) {
        info = array.get(0) + "/" + array.get(1) + ", ";
        info = info + array.get(2) + "/" + array.get(3) + ", ";
        info = info + array.get(4) + "/" + array.get(5) + ".";
    }
    cell2.setCellValue(title + info);
    CellStyle cellStyle = this.wb.createCellStyle();
    cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
    cellStyle.setAlignment(HorizontalAlignment.LEFT);
    // font 
    Font font = this.wb.createFont();
    font.setFontHeightInPoints((short) 14);
    font.setFontName(HSSFFont.FONT_ARIAL);
    font.setBold(true);
    font.setColor(HSSFColor.BLACK.index);

    cellStyle.setFont(font);
    cell2.setCellStyle(cellStyle);

}

From source file:Controller.Sonstiges.ExcelController.java

private void makeTitleOfTable() {
    this.row = this.sheet.createRow(this.firstRow);
    CellStyle cellStyle = this.wb.createCellStyle();
    // font //from   w  ww .  j  a v  a 2  s .co m
    Font font = this.wb.createFont();
    font.setFontHeightInPoints((short) 10);
    font.setFontName(HSSFFont.FONT_ARIAL);

    font.setBold(true);
    font.setColor(HSSFColor.BLACK.index);

    cellStyle.setFont(font);
    this.saveDataInExcel(0, "Urz", cellStyle);
    this.saveDataInExcel(1, "Vorname", cellStyle);
    this.saveDataInExcel(2, "Name", cellStyle);
    this.saveDataInExcel(3, "Fakultt", cellStyle);
    this.saveDataInExcel(4, "Geburtsdatum", cellStyle);
    this.saveDataInExcel(5, "E-Mail", cellStyle);
    this.saveDataInExcel(6, "Telefonnummer", cellStyle);
    this.saveDataInExcel(7, "Aktivitten-ID", cellStyle);
    this.saveDataInExcel(8, "Aktivittenname", cellStyle);
    this.saveDataInExcel(9, "Zeitraum", cellStyle);
    this.saveDataInExcel(10, "Art", cellStyle);
    this.saveDataInExcel(11, "Durchfhrung", cellStyle);
    this.saveDataInExcel(12, "Bemerkung", cellStyle);
    this.saveDataInExcel(13, "Status", cellStyle);

}

From source file:de.alpharogroup.export.excel.poi.ExcelPoiFactory.java

License:Open Source License

/**
 * Creates a new font from the given parameters.
 *
 * @param workbook//from   ww  w .  j  a  va2  s .c  o  m
 *            the workbook
 * @param fontName
 *            the font name
 * @param boldweight
 *            the boldweight
 * @param height
 *            the height
 * @return the font
 */
public static Font newFont(final Workbook workbook, final String fontName, final short boldweight,
        final short height) {
    final Font font = workbook.createFont();
    font.setFontName(fontName);
    font.setBoldweight(boldweight);
    font.setFontHeightInPoints(height);
    return font;
}

From source file:de.iteratec.iteraplan.businesslogic.exchange.elasticExcel.export.template.ExcelStylesCreator.java

License:Open Source License

private static CellStyle getHeaderStyle(Workbook workbook) {
    CellStyle style = workbook.createCellStyle();
    style.setFillPattern(CellStyle.SOLID_FOREGROUND);
    setCustomVioletForegroundColor(workbook, style);
    Font font = workbook.createFont();
    font.setColor(IndexedColors.WHITE.getIndex());
    font.setBoldweight(Font.BOLDWEIGHT_BOLD);
    font.setFontHeightInPoints(EXCEL_HEADER_FONT_HEIGHT);
    font.setFontName(EXCEL_HEADER_FONT_NAME);
    style.setFont(font);/*from   w  ww . j  av  a  2s  .c o m*/

    return style;
}

From source file:de.iteratec.iteraplan.businesslogic.exchange.legacyExcel.exporter.ExportWorkbook.java

License:Open Source License

/**
 * initializes all styles used in the workbook
 *///w w w  .  jav a2 s  .co m
private void initStyles() {

    titleStyle = getWb().createCellStyle();
    headerStyle = getWb().createCellStyle();
    headerTableStyle = getWb().createCellStyle();
    dateStyle = getWb().createCellStyle();
    wrappedStyle = getWb().createCellStyle();
    defaultStyle = getWb().createCellStyle();
    hyperlinkStyle = getWb().createCellStyle();

    DataFormat df = getWb().createDataFormat();

    Font font = getWb().createFont();
    font.setFontHeightInPoints((short) 12);
    font.setFontName(ExcelWorkbook.EXCEL_DEFAULT_FONT);
    font.setBoldweight(Font.BOLDWEIGHT_BOLD);
    titleStyle.setFont(font);

    font = getWb().createFont();
    font.setFontHeightInPoints((short) 11);
    font.setFontName(ExcelWorkbook.EXCEL_DEFAULT_FONT);
    headerStyle.setFont(font);

    font = getWb().createFont();
    font.setFontHeightInPoints((short) 11);
    font.setFontName(ExcelWorkbook.EXCEL_DEFAULT_FONT);
    font.setBoldweight(Font.BOLDWEIGHT_BOLD);
    headerTableStyle.setFont(font);

    dateStyle.setDataFormat(df.getFormat("m/d/yy"));
    setAlignementTopLeft(dateStyle);

    wrappedStyle.setWrapText(true);
    setAlignementTopLeft(wrappedStyle);

    setAlignementTopLeft(defaultStyle);

    Font hlinkFont = getWb().createFont();
    hlinkFont.setUnderline(Font.U_SINGLE);
    hlinkFont.setColor(IndexedColors.BLUE.getIndex());
    setAlignementTopLeft(hyperlinkStyle);
    hyperlinkStyle.setFont(hlinkFont);
}

From source file:de.jlo.talendcomp.excel.SpreadsheetFile.java

License:Apache License

/**
 * adds a font to the workbook/*from  w w w  .j a va 2  s.c o  m*/
 * @param family like Arial
 * @param height like 8,9,10,12,14...
 * @param bui with "b"=bold, "u"=underlined, "i"=italic and all combinations as String
 * @param color color index
 */
public void addStyle(String styleName, String fontFamily, String fontHeight, String fontDecoration,
        String fontColor, String bgColor, String textAlign, boolean buttomBorder) {
    if (styleName != null && styleName.isEmpty() == false) {
        Font f = workbook.createFont();
        if (fontFamily != null && fontFamily.isEmpty() == false) {
            f.setFontName(fontFamily);
        }
        if (fontHeight != null && fontHeight.isEmpty() == false) {
            short height = Short.parseShort(fontHeight);
            if (height > 0) {
                f.setFontHeightInPoints(height);
            }
        }
        if (fontDecoration != null && fontDecoration.isEmpty() == false) {
            if (fontDecoration.contains("b")) {
                f.setBold(true);
            }
            if (fontDecoration.contains("i")) {
                f.setItalic(true);
            }
            if (fontDecoration.contains("u")) {
                f.setUnderline(Font.U_SINGLE);
            }
        }
        if (fontColor != null && fontColor.isEmpty() == false) {
            short color = Short.parseShort(fontColor);
            f.setColor(color);
        }
        CellStyle style = workbook.createCellStyle();
        style.setFont(f);
        if (bgColor != null && bgColor.isEmpty() == false) {
            short color = Short.parseShort(bgColor);
            style.setFillForegroundColor(color);
            //style.setFillBackgroundColor(color);
            style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
        }
        if (textAlign != null && textAlign.isEmpty() == false) {
            if ("center".equalsIgnoreCase(textAlign)) {
                style.setAlignment(HorizontalAlignment.CENTER);
            } else if ("left".equalsIgnoreCase(textAlign)) {
                style.setAlignment(HorizontalAlignment.LEFT);
            } else if ("right".equals(textAlign)) {
                style.setAlignment(HorizontalAlignment.RIGHT);
            }
        }
        if (buttomBorder) {
            style.setBorderBottom(BorderStyle.MEDIUM);
            style.setBottomBorderColor((short) 9);
        }
        namedStyles.put(styleName, style);
    }
}