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

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

Introduction

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

Prototype

byte U_SINGLE

To view the source code for org.apache.poi.ss.usermodel Font U_SINGLE.

Click Source Link

Document

single (normal) underline

Usage

From source file:org.openpythia.plugin.worststatements.DeltaSnapshotWriter.java

License:Apache License

private CellStyle createHyperlinkStyle(Workbook workbook) {
    // cell style for hyperlinks
    // by default hyperlinks are blue and underlined
    CellStyle hyperlinkStyle = workbook.createCellStyle();
    hyperlinkStyle.cloneStyleFrom(statementsSheet.getRow(INDEX_ROW_TEMPLATE_DELTA_SQL_STATEMENT)
            .getCell(INDEX_COLUMN_SQL_TEXT).getCellStyle());

    Font hyperlinkFont = workbook.createFont();
    hyperlinkFont.setUnderline(Font.U_SINGLE);
    hyperlinkFont.setColor(IndexedColors.BLUE.getIndex());

    hyperlinkStyle.setFont(hyperlinkFont);

    return hyperlinkStyle;
}

From source file:org.pentaho.di.trans.steps.excelwriter.ExcelWriterStep.java

License:Apache License

void writeField(Object v, ValueMetaInterface vMeta, ExcelWriterStepField excelField, Row xlsRow, int posX,
        Object[] row, int fieldNr, boolean isTitle) throws KettleException {
    try {// w ww . j av a  2s. c om
        boolean cellExisted = true;
        // get the cell
        Cell cell = xlsRow.getCell(posX);
        if (cell == null) {
            cellExisted = false;
            cell = xlsRow.createCell(posX);
        }

        // if cell existed and existing cell's styles should not be changed, don't
        if (!(cellExisted && meta.isLeaveExistingStylesUnchanged())) {

            // if the style of this field is cached, reuse it
            if (!isTitle && data.getCachedStyle(fieldNr) != null) {
                cell.setCellStyle(data.getCachedStyle(fieldNr));
            } else {
                // apply style if requested
                if (excelField != null) {

                    // determine correct cell for title or data rows
                    String styleRef = null;
                    if (!isTitle && !Utils.isEmpty(excelField.getStyleCell())) {
                        styleRef = excelField.getStyleCell();
                    } else if (isTitle && !Utils.isEmpty(excelField.getTitleStyleCell())) {
                        styleRef = excelField.getTitleStyleCell();
                    }

                    if (styleRef != null) {
                        Cell styleCell = getCellFromReference(styleRef);
                        if (styleCell != null && cell != styleCell) {
                            cell.setCellStyle(styleCell.getCellStyle());
                        }
                    }
                }

                // set cell format as specified, specific format overrides cell specification
                if (!isTitle && excelField != null && !Utils.isEmpty(excelField.getFormat())
                        && !excelField.getFormat().startsWith("Image")) {
                    setDataFormat(excelField.getFormat(), cell);
                }
                // cache it for later runs
                if (!isTitle) {
                    data.cacheStyle(fieldNr, cell.getCellStyle());
                }
            }
        }

        // create link on cell if requested
        if (!isTitle && excelField != null && data.linkfieldnrs[fieldNr] >= 0) {
            String link = data.inputRowMeta.getValueMeta(data.linkfieldnrs[fieldNr])
                    .getString(row[data.linkfieldnrs[fieldNr]]);
            if (!Utils.isEmpty(link)) {
                CreationHelper ch = data.wb.getCreationHelper();
                // set the link on the cell depending on link type
                Hyperlink hyperLink = null;
                if (link.startsWith("http:") || link.startsWith("https:") || link.startsWith("ftp:")) {
                    hyperLink = ch.createHyperlink(HyperlinkType.URL);
                    hyperLink.setLabel("URL Link");
                } else if (link.startsWith("mailto:")) {
                    hyperLink = ch.createHyperlink(HyperlinkType.EMAIL);
                    hyperLink.setLabel("Email Link");
                } else if (link.startsWith("'")) {
                    hyperLink = ch.createHyperlink(HyperlinkType.DOCUMENT);
                    hyperLink.setLabel("Link within this document");
                } else {
                    hyperLink = ch.createHyperlink(HyperlinkType.FILE);
                    hyperLink.setLabel("Link to a file");
                }

                hyperLink.setAddress(link);
                cell.setHyperlink(hyperLink);

                // if cell existed and existing cell's styles should not be changed, don't
                if (!(cellExisted && meta.isLeaveExistingStylesUnchanged())) {

                    if (data.getCachedLinkStyle(fieldNr) != null) {
                        cell.setCellStyle(data.getCachedLinkStyle(fieldNr));
                    } else {
                        // CellStyle style = cell.getCellStyle();
                        Font origFont = data.wb.getFontAt(cell.getCellStyle().getFontIndex());
                        Font hlink_font = data.wb.createFont();
                        // reporduce original font characteristics

                        hlink_font.setBold(origFont.getBold());
                        hlink_font.setCharSet(origFont.getCharSet());
                        hlink_font.setFontHeight(origFont.getFontHeight());
                        hlink_font.setFontName(origFont.getFontName());
                        hlink_font.setItalic(origFont.getItalic());
                        hlink_font.setStrikeout(origFont.getStrikeout());
                        hlink_font.setTypeOffset(origFont.getTypeOffset());
                        // make it blue and underlined
                        hlink_font.setUnderline(Font.U_SINGLE);
                        hlink_font.setColor(IndexedColors.BLUE.getIndex());
                        CellStyle style = cell.getCellStyle();
                        style.setFont(hlink_font);
                        cell.setCellStyle(style);
                        data.cacheLinkStyle(fieldNr, cell.getCellStyle());
                    }
                }
            }
        }

        // create comment on cell if requrested
        if (!isTitle && excelField != null && data.commentfieldnrs[fieldNr] >= 0
                && data.wb instanceof XSSFWorkbook) {
            String comment = data.inputRowMeta.getValueMeta(data.commentfieldnrs[fieldNr])
                    .getString(row[data.commentfieldnrs[fieldNr]]);
            if (!Utils.isEmpty(comment)) {
                String author = data.commentauthorfieldnrs[fieldNr] >= 0
                        ? data.inputRowMeta.getValueMeta(data.commentauthorfieldnrs[fieldNr]).getString(
                                row[data.commentauthorfieldnrs[fieldNr]])
                        : "Kettle PDI";
                cell.setCellComment(createCellComment(author, comment));
            }
        }
        // cell is getting a formula value or static content
        if (!isTitle && excelField != null && excelField.isFormula()) {
            // formula case
            cell.setCellFormula(vMeta.getString(v));
        } else {
            // static content case
            switch (vMeta.getType()) {
            case ValueMetaInterface.TYPE_DATE:
                if (v != null && vMeta.getDate(v) != null) {
                    cell.setCellValue(vMeta.getDate(v));
                }
                break;
            case ValueMetaInterface.TYPE_BOOLEAN:
                if (v != null) {
                    cell.setCellValue(vMeta.getBoolean(v));
                }
                break;
            case ValueMetaInterface.TYPE_STRING:
            case ValueMetaInterface.TYPE_BINARY:
                if (v != null) {
                    cell.setCellValue(vMeta.getString(v));
                }
                break;
            case ValueMetaInterface.TYPE_BIGNUMBER:
            case ValueMetaInterface.TYPE_NUMBER:
            case ValueMetaInterface.TYPE_INTEGER:
                if (v != null) {
                    cell.setCellValue(vMeta.getNumber(v));
                }
                break;
            default:
                break;
            }
        }
    } catch (Exception e) {
        logError("Error writing field (" + data.posX + "," + data.posY + ") : " + e.toString());
        logError(Const.getStackTracker(e));
        throw new KettleException(e);
    }
}

From source file:org.pentaho.reporting.engine.classic.core.modules.output.table.xls.helper.ExcelFontFactory.java

License:Open Source License

/**
 * Returns the excel font stored in this wrapper.
 *
 * @param wrapper//w ww . j a  va 2 s  .  c om
 *          the font wrapper that holds all font information from the repagination.
 * @return the created font.
 */
private Font createFont(final HSSFFontWrapper wrapper) {
    final Font font = workbook.createFont();
    font.setBold(wrapper.isBold());
    font.setColor(wrapper.getColorIndex());
    font.setFontName(wrapper.getFontName());
    font.setFontHeightInPoints((short) wrapper.getFontHeight());
    font.setItalic(wrapper.isItalic());
    font.setStrikeout(wrapper.isStrikethrough());
    if (wrapper.isUnderline()) {
        font.setUnderline(Font.U_SINGLE);
    } else {
        font.setUnderline(Font.U_NONE);
    }
    return font;
}

From source file:org.rapidpm.data.table.export.Table2XLSX.java

License:Apache License

private CellStyle createHyperLinkStyle(final XSSFWorkbook workbook) {
    final CellStyle hlink_style = workbook.createCellStyle();
    final Font hlink_font = workbook.createFont();
    hlink_font.setUnderline(Font.U_SINGLE);
    hlink_font.setColor(IndexedColors.BLUE.getIndex());
    hlink_style.setFont(hlink_font);/*  ww  w. j  a  v a 2  s.  c om*/
    return hlink_style;
}

From source file:org.sakaiproject.signup.tool.downloadEvents.WorksheetStyleClass.java

License:Educational Community License

public static Map<String, CellStyle> createStyles(Workbook wb) {
    Map<String, CellStyle> styles = new HashMap<String, CellStyle>();
    CellStyle style;//from w  w w  . j  ava2 s  .co m
    Font titleFont = wb.createFont();
    titleFont.setFontHeightInPoints((short) 18);
    titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    titleFont.setColor(IndexedColors.DARK_BLUE.getIndex());
    style = wb.createCellStyle();
    style.setAlignment(CellStyle.ALIGN_CENTER);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    style.setFont(titleFont);
    styles.put("title", style);

    Font commentTitleFont = wb.createFont();
    commentTitleFont.setFontHeightInPoints((short) 12);
    commentTitleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    commentTitleFont.setColor(IndexedColors.DARK_BLUE.getIndex());
    style = wb.createCellStyle();
    style.setAlignment(CellStyle.ALIGN_LEFT);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    style.setFont(commentTitleFont);
    styles.put("commentTitle", style);

    Font itemFont = wb.createFont();
    itemFont.setFontHeightInPoints((short) 10);
    itemFont.setFontName("Trebuchet MS");
    style = wb.createCellStyle();
    style.setAlignment(CellStyle.ALIGN_LEFT);
    style.setFont(itemFont);
    styles.put("item_left", style);

    style = wb.createCellStyle();
    style.setAlignment(CellStyle.ALIGN_LEFT);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    style.setFont(itemFont);
    style.setWrapText(true);
    styles.put("item_left_wrap", style);

    style = wb.createCellStyle();
    style.setAlignment(CellStyle.ALIGN_LEFT);
    style.setVerticalAlignment(CellStyle.VERTICAL_TOP);
    style.setFont(itemFont);
    style.setWrapText(true);
    styles.put("item_left_wrap_top", style);

    itemFont.setFontHeightInPoints((short) 10);
    itemFont.setFontName("Trebuchet MS");
    style = wb.createCellStyle();
    style.setAlignment(CellStyle.ALIGN_CENTER);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    style.setFont(itemFont);
    styles.put("tabItem_fields", style);

    style = wb.createCellStyle();
    style.setAlignment(CellStyle.ALIGN_RIGHT);
    style.setFont(itemFont);
    styles.put("item_right", style);

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

    Font itemBoldFont = wb.createFont();
    itemBoldFont.setFontHeightInPoints((short) 10);
    itemBoldFont.setFontName("Trebuchet MS");
    itemBoldFont.setColor(IndexedColors.DARK_BLUE.getIndex());
    style = wb.createCellStyle();
    style.setAlignment(CellStyle.ALIGN_LEFT);
    style.setVerticalAlignment(CellStyle.VERTICAL_TOP);
    itemBoldFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    style.setFont(itemBoldFont);
    styles.put("item_leftBold", style);

    Font tableFont = wb.createFont();
    tableFont.setFontHeightInPoints((short) 12);
    tableFont.setColor(IndexedColors.WHITE.getIndex());
    tableFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    style = wb.createCellStyle();
    style.setAlignment(CellStyle.ALIGN_CENTER);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    style.setFillForegroundColor(IndexedColors.DARK_BLUE.getIndex());
    style.setFillPattern(CellStyle.SOLID_FOREGROUND);
    style.setFont(tableFont);
    styles.put("tabColNames", style);

    tableFont.setFontHeightInPoints((short) 10);
    tableFont.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(tableFont);
    style.setWrapText(true);
    styles.put("header", style);

    Font linkFont = wb.createFont();
    linkFont.setFontHeightInPoints((short) 10);
    linkFont.setColor(IndexedColors.BLUE.getIndex());
    linkFont.setUnderline(Font.U_SINGLE);
    style = wb.createCellStyle();
    style.setAlignment(CellStyle.ALIGN_LEFT);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    style.setFont(linkFont);
    styles.put("hyperLink", style);

    style = wb.createCellStyle();
    style.setBorderTop(CellStyle.BORDER_THICK);
    style.setTopBorderColor(IndexedColors.DARK_BLUE.getIndex());
    styles.put("tab_endline", style);

    return styles;
}

From source file:org.sigmah.server.endpoint.export.sigmah.spreadsheet.ExcelUtils.java

License:Open Source License

public void createLinkCell(HSSFCell cell, String value, String target, boolean bordered) {
    cell.setCellValue(value);//ww  w .j a v  a2 s  .  co m

    CellStyle style = wb.createCellStyle();
    if (bordered)
        style = createBorderedStyle(wb);
    Font hlink_font = wb.createFont();
    hlink_font.setUnderline(Font.U_SINGLE);
    hlink_font.setColor(IndexedColors.BLUE.getIndex());
    style.setFont(hlink_font);
    style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
    style.setIndention((short) 1);
    style.setWrapText(true);

    HSSFHyperlink link = new HSSFHyperlink(HSSFHyperlink.LINK_DOCUMENT);
    link.setAddress("'" + normalizeAsLink(target) + "'!A1");
    cell.setHyperlink(link);
    cell.setCellStyle(style);
}

From source file:org.unitime.timetable.export.XLSPrinter.java

License:Apache License

protected Font getFont(boolean bold, boolean italic, boolean underline, Color c) {
    Short color = null;/* www  . j a  v a2 s  .  c o  m*/
    if (c == null)
        c = Color.BLACK;
    if (c != null) {
        String colorId = Integer.toHexString(c.getRGB());
        color = iColors.get(colorId);
        if (color == null) {
            HSSFPalette palette = ((HSSFWorkbook) iWorkbook).getCustomPalette();
            HSSFColor clr = palette.findSimilarColor(c.getRed(), c.getGreen(), c.getBlue());
            color = (clr == null ? IndexedColors.BLACK.getIndex() : clr.getIndex());
            iColors.put(colorId, color);
        }
    }
    String fontId = (bold ? "b" : "") + (italic ? "i" : "") + (underline ? "u" : "")
            + (color == null ? "" : color);
    Font font = iFonts.get(fontId);
    if (font == null) {
        font = iWorkbook.createFont();
        font.setBold(bold);
        font.setItalic(italic);
        font.setUnderline(underline ? Font.U_SINGLE : Font.U_NONE);
        font.setColor(color);
        font.setFontHeightInPoints((short) 10);
        font.setFontName("Arial");
        iFonts.put(fontId, font);
    }
    return font;
}

From source file:packtest.CreateCell.java

License:Apache License

public static void main(String[] args) throws Exception {
    Workbook wb = new XSSFWorkbook(); //or new HSSFWorkbook();
    CreationHelper creationHelper = wb.getCreationHelper();
    Sheet sheet = wb.createSheet("new sheet");

    // Create a row and put some cells in it. Rows are 0 based.
    Row row = sheet.createRow((short) 0);
    // Create a cell and put a value in it.
    Cell cell = row.createCell((short) 0);
    cell.setCellValue(1);/*from   www.  j a  v  a 2  s . c o m*/

    //numeric value
    row.createCell(1).setCellValue(1.2);

    //plain string value
    row.createCell(2).setCellValue("This is a string cell");

    //rich text string
    RichTextString str = creationHelper.createRichTextString("Apache");
    Font font = wb.createFont();
    font.setItalic(true);
    font.setUnderline(Font.U_SINGLE);
    str.applyFont(font);
    row.createCell(3).setCellValue(str);

    //boolean value
    row.createCell(4).setCellValue(true);

    //formula
    row.createCell(5).setCellFormula("SUM(A1:B1)");

    //date
    CellStyle style = wb.createCellStyle();
    style.setDataFormat(creationHelper.createDataFormat().getFormat("m/d/yy h:mm"));
    cell = row.createCell(6);
    cell.setCellValue(new Date());
    cell.setCellStyle(style);

    //hyperlink
    row.createCell(7).setCellFormula("SUM(A1:B1)");
    cell.setCellFormula("HYPERLINK(\"http://google.com\",\"Google\")");

    // Write the output to a file
    FileOutputStream fileOut = new FileOutputStream("ooxml-cell.xlsx");
    wb.write(fileOut);
    fileOut.close();
}

From source file:packtest.HyperlinkExample.java

License:Apache License

public static void main(String[] args) throws Exception {
    Workbook wb = new XSSFWorkbook(); //or new HSSFWorkbook();
    CreationHelper createHelper = wb.getCreationHelper();

    //cell style for hyperlinks
    //by default hyperlinks are blue and underlined
    CellStyle hlink_style = wb.createCellStyle();
    Font hlink_font = wb.createFont();
    hlink_font.setUnderline(Font.U_SINGLE);
    hlink_font.setColor(IndexedColors.BLUE.getIndex());
    hlink_style.setFont(hlink_font);// w w  w  .j  av  a  2s .c  om

    Cell cell;
    Sheet sheet = wb.createSheet("Hyperlinks");
    //URL
    cell = sheet.createRow(0).createCell((short) 0);
    cell.setCellValue("URL Link");

    Hyperlink link = createHelper.createHyperlink(Hyperlink.LINK_URL);
    link.setAddress("http://poi.apache.org/");
    cell.setHyperlink(link);
    cell.setCellStyle(hlink_style);

    //link to a file in the current directory
    cell = sheet.createRow(1).createCell((short) 0);
    cell.setCellValue("File Link");
    link = createHelper.createHyperlink(Hyperlink.LINK_FILE);
    link.setAddress("link1.xls");
    cell.setHyperlink(link);
    cell.setCellStyle(hlink_style);

    //e-mail link
    cell = sheet.createRow(2).createCell((short) 0);
    cell.setCellValue("Email Link");
    link = createHelper.createHyperlink(Hyperlink.LINK_EMAIL);
    //note, if subject contains white spaces, make sure they are url-encoded
    link.setAddress("mailto:poi@apache.org?subject=Hyperlinks");
    cell.setHyperlink(link);
    cell.setCellStyle(hlink_style);

    //link to a place in this workbook

    //create a target sheet and cell
    Sheet sheet2 = wb.createSheet("Target Sheet");
    sheet2.createRow(0).createCell((short) 0).setCellValue("Target Cell");

    cell = sheet.createRow(3).createCell((short) 0);
    cell.setCellValue("Worksheet Link");
    Hyperlink link2 = createHelper.createHyperlink(Hyperlink.LINK_DOCUMENT);
    link2.setAddress("'Target Sheet'!A1");
    cell.setHyperlink(link2);
    cell.setCellStyle(hlink_style);

    FileOutputStream out = new FileOutputStream(Utils.getPath("hyperinks.xlsx"));
    wb.write(out);
    out.close();

}

From source file:step.datapool.excel.StyleSyntax.java

License:Open Source License

/**
 * Analysiert den angegebenen Stil und setzt diesen excel-konform.
 * //from  w  w w  .ja v a  2s  . c om
 * @param strStyle strStyle
 * @param _wb _wb
 * @return XSSFCellStyle
 */
public static XSSFCellStyle composeStyle(String strStyle, Workbook _wb) {
    if (_wb instanceof XSSFWorkbook) {
        XSSFWorkbook wb = (XSSFWorkbook) _wb;
        if (strStyle == null || strStyle.isEmpty())
            return null;
        XSSFCellStyle style = wb.createCellStyle();
        XSSFFont font = wb.createFont();
        strStyle = replaceColors(strStyle);

        /* Unterteilung der verschiedenen Stilangaben: Schriftschnitt, Vordergrund/Hintergrundfarbe, Schriftgroesse, Schriftsatz */
        String[] arr = strStyle.split(",");
        for (String str : arr) {
            /* Abhandlung des Schriftschnitts. Diese koennen alle zusammen auftreten und schliessen sich nicht aus */
            if (str.matches("( *bold *| *italic *| *underline *| *strikeout *)*")) {
                if (str.contains("bold")) {
                    font.setBoldweight(Font.BOLDWEIGHT_BOLD);
                }
                if (str.contains("italic")) {
                    font.setItalic(true);
                }
                if (str.contains("underline")) {
                    font.setUnderline(Font.U_SINGLE);
                }
                if (str.contains("strikeout")) {
                    font.setStrikeout(true);
                }
                continue;
            }
            /* Abhandlung der Farben */
            if (str.contains("/") && !str.contains(":")) {
                continue;
            }
            if (str.contains(":")) {
                String[] fgBg;
                /* Vordergrund / Hintergrund */
                if (str.contains("/")) {
                    fgBg = str.split("/");
                } else {
                    /* Verkuerzte Angabe ohne / (nur Vordergrund) */
                    fgBg = new String[1];
                    fgBg[0] = str;
                }

                for (int i = 0; i < fgBg.length; i++) {
                    fgBg[i] = fgBg[i].trim();
                    if (!fgBg[i].isEmpty()) {
                        String[] clr = fgBg[i].split(":");
                        if (clr.length != 3) {
                            return null;
                        }
                        int red = Integer.parseInt(clr[0].trim());
                        int green = Integer.parseInt(clr[1].trim());
                        int blue = Integer.parseInt(clr[2].trim());

                        if (i == 0) {
                            /* Schriftfarbe
                             *  -------------------------------------------------------------
                             * | ACHTUNG: poi hat einen Fehler beim Setzen der Schriftfarbe! |
                             *  -------------------------------------------------------------
                             *  Weiss und Schwarz sind verwechselt worden! Gilt NUR fuer
                             *  font.setColor!
                             *  Deshalb wird hier einfach Weiss auf Schwarz korrigiert und
                             *  umgekehrt.
                             */
                            if (red == 0 && green == 0 && blue == 0) {
                                red = 255;
                                green = 255;
                                blue = 255;
                            } else if (red == 255 && green == 255 && blue == 255) {
                                red = 0;
                                green = 0;
                                blue = 0;
                            }
                            XSSFColor xssfColor = new XSSFColor(new Color(red, green, blue));
                            font.setColor(xssfColor);
                        } else {
                            // Vordergrund/Hintergrundfarbe der Zelle
                            XSSFColor xssfColor = new XSSFColor(new Color(red, green, blue));
                            style.setFillForegroundColor(xssfColor);
                            style.setFillBackgroundColor(xssfColor);
                            style.setFillPattern(CellStyle.SOLID_FOREGROUND);
                        }

                    }
                }
                continue;
            }
            /* Abhandlung der Schriftgroesse */
            if (str.matches(" *[1-9][0-9]* *")) {
                short fontHeightInPoints = Short.parseShort(str.trim());
                font.setFontHeightInPoints(fontHeightInPoints);
                continue;
            }
            /* Abhandlung der Schriftart */
            if (!str.isEmpty()) {
                font.setFontName(str);
                continue;
            }
        }
        style.setFont(font);
        return style;
    } else {
        return null;
    }
}