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

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

Introduction

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

Prototype

byte U_NONE

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

Click Source Link

Document

not underlined

Usage

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/*from w ww.ja v  a2 s  .c o  m*/
 *          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.unitime.timetable.export.XLSPrinter.java

License:Apache License

protected Font getFont(boolean bold, boolean italic, boolean underline, Color c) {
    Short color = null;//from   w  ww  .  ja  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:ru.icc.cells.ssdc.DataLoader.java

License:Apache License

private void fillFont(CFont font, Font excelFont) {
    font.setName(excelFont.getFontName());

    // TODO    CFont font
    //font.setColor( excelFont.getColor() );

    font.setHeight(excelFont.getFontHeight());
    font.setHeightInPoints(excelFont.getFontHeightInPoints());

    // TODO ?  ? Boldweight, ?? ? ? 
    short boldWeight = excelFont.getBoldweight();
    if (boldWeight >= 700)
        font.setBold(true);// ww w.  j av a 2s . c om

    font.setItalic(excelFont.getItalic());
    font.setStrikeout(excelFont.getStrikeout());

    byte underline = excelFont.getUnderline();
    if (underline != Font.U_NONE)
        font.setUnderline(true);
    if (underline == Font.U_DOUBLE || underline == Font.U_DOUBLE_ACCOUNTING)
        font.setDoubleUnderline(true);
}