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:biz.webgate.dominoext.poi.component.kernel.WorkbookProcessor.java

License:Apache License

public synchronized void checkStyleConstantValues() {
    if (m_StyleConstantValues == null) {
        m_StyleConstantValues = new HashMap<String, Short>();
        m_StyleConstantValues.put("ALIGN_CENTER", CellStyle.ALIGN_CENTER);
        m_StyleConstantValues.put("ALIGN_CENTER_SELECTION", CellStyle.ALIGN_CENTER_SELECTION);
        m_StyleConstantValues.put("ALIGN_FILL", CellStyle.ALIGN_FILL);
        m_StyleConstantValues.put("ALIGN_GENERAL", CellStyle.ALIGN_GENERAL);
        m_StyleConstantValues.put("ALIGN_JUSTIFY", CellStyle.ALIGN_JUSTIFY);
        m_StyleConstantValues.put("ALIGN_LEFT", CellStyle.ALIGN_LEFT);
        m_StyleConstantValues.put("ALIGN_RIGHT", CellStyle.ALIGN_RIGHT);

        m_StyleConstantValues.put("BORDER_DASH_DOT", CellStyle.BORDER_DASH_DOT);
        m_StyleConstantValues.put("BORDER_DASH_DOT_DOT", CellStyle.BORDER_DASH_DOT_DOT);
        m_StyleConstantValues.put("BORDER_DASHED", CellStyle.BORDER_DASHED);
        m_StyleConstantValues.put("BORDER_DOTTED", CellStyle.BORDER_DOTTED);
        m_StyleConstantValues.put("BORDER_DOUBLE", CellStyle.BORDER_DOUBLE);
        m_StyleConstantValues.put("BORDER_HAIR", CellStyle.BORDER_HAIR);
        m_StyleConstantValues.put("BORDER_MEDIUM", CellStyle.BORDER_MEDIUM);
        m_StyleConstantValues.put("BORDER_MEDIUM_DASH_DOT", CellStyle.BORDER_MEDIUM_DASH_DOT);
        m_StyleConstantValues.put("BORDER_MEDIUM_DASH_DOT_DOT", CellStyle.BORDER_MEDIUM_DASH_DOT_DOT);
        m_StyleConstantValues.put("BORDER_MEDIUM_DASHED", CellStyle.BORDER_MEDIUM_DASHED);
        m_StyleConstantValues.put("BORDER_NONE", CellStyle.BORDER_NONE);
        m_StyleConstantValues.put("BORDER_SLANTED_DASH_DOT", CellStyle.BORDER_SLANTED_DASH_DOT);
        m_StyleConstantValues.put("BORDER_THICK", CellStyle.BORDER_THICK);
        m_StyleConstantValues.put("BORDER_THIN", CellStyle.BORDER_THIN);

        m_StyleConstantValues.put("ALT_BARS", CellStyle.ALT_BARS);
        m_StyleConstantValues.put("BIG_SPOTS", CellStyle.BIG_SPOTS);
        m_StyleConstantValues.put("BRICKS", CellStyle.BRICKS);
        m_StyleConstantValues.put("DIAMONDS", CellStyle.DIAMONDS);
        m_StyleConstantValues.put("FINE_DOTS", CellStyle.FINE_DOTS);
        m_StyleConstantValues.put("LEAST_DOTS", CellStyle.LEAST_DOTS);
        m_StyleConstantValues.put("LESS_DOTS", CellStyle.LESS_DOTS);
        m_StyleConstantValues.put("NO_FILL", CellStyle.NO_FILL);
        m_StyleConstantValues.put("SOLID_FOREGROUND", CellStyle.SOLID_FOREGROUND);
        m_StyleConstantValues.put("SPARSE_DOTS", CellStyle.SPARSE_DOTS);
        m_StyleConstantValues.put("SQUARES", CellStyle.SQUARES);
        m_StyleConstantValues.put("THICK_BACKWARD_DIAG", CellStyle.THICK_BACKWARD_DIAG);
        m_StyleConstantValues.put("THICK_FORWARD_DIAG", CellStyle.THICK_FORWARD_DIAG);
        m_StyleConstantValues.put("THICK_HORZ_BANDS", CellStyle.THICK_HORZ_BANDS);
        m_StyleConstantValues.put("THICK_VERT_BANDS", CellStyle.THICK_VERT_BANDS);
        m_StyleConstantValues.put("THIN_BACKWARD_DIAG", CellStyle.THIN_BACKWARD_DIAG);
        m_StyleConstantValues.put("THIN_FORWARD_DIAG", CellStyle.THIN_FORWARD_DIAG);
        m_StyleConstantValues.put("THIN_HORZ_BANDS", CellStyle.THIN_HORZ_BANDS);
        m_StyleConstantValues.put("THIN_VERT_BANDS", CellStyle.THIN_VERT_BANDS);

        m_StyleConstantValues.put("VERTICAL_BOTTOM", CellStyle.VERTICAL_BOTTOM);
        m_StyleConstantValues.put("VERTICAL_CENTER", CellStyle.VERTICAL_CENTER);
        m_StyleConstantValues.put("VERTICAL_JUSTIFY", CellStyle.VERTICAL_JUSTIFY);
        m_StyleConstantValues.put("VERTICAL_TOP", CellStyle.VERTICAL_TOP);

        m_StyleConstantValues.put("SS_NONE", Font.SS_NONE);
        m_StyleConstantValues.put("SS_SUPER", Font.SS_SUPER);
        m_StyleConstantValues.put("SS_SUB", Font.SS_SUB);

        m_StyleConstantValues.put("BOLDWEIGHT_BOLD", Font.BOLDWEIGHT_BOLD);
        m_StyleConstantValues.put("BOLDWEIGHT_NORMAL", Font.BOLDWEIGHT_NORMAL);

    }//from  ww w .  java  2  s  .  co m

    if (m_StyleByteConstantValues == null) {
        m_StyleByteConstantValues = new HashMap<String, Byte>();
        m_StyleByteConstantValues.put("U_NONE", Font.U_NONE);
        m_StyleByteConstantValues.put("U_SINGLE", Font.U_SINGLE);
        m_StyleByteConstantValues.put("U_DOUBLE", Font.U_DOUBLE);
        m_StyleByteConstantValues.put("U_SINGLE_ACCOUNTING", Font.U_SINGLE_ACCOUNTING);
        m_StyleByteConstantValues.put("U_DOUBLE_ACCOUNTING", Font.U_DOUBLE_ACCOUNTING);
    }
}

From source file:br.com.tecsinapse.dataio.style.TableCellStyle.java

License:LGPL

private void configFont(Font font) {
    font.setBold(isBold());/*ww w  .  ja v a 2 s  .c  o m*/
    font.setItalic(isItalic());
    font.setStrikeout(isStrikeout());
    font.setUnderline(isUnderline() ? Font.U_SINGLE : Font.U_NONE);
    if (getFontSize() != null) {
        font.setFontHeightInPoints(fontSize.shortValue());
    }
    if (getFontColor() != null) {
        if (font instanceof XSSFFont) {
            ((XSSFFont) font).setColor(new XSSFColor(toIndexedColorMap(fontColor)));
        } else {
            font.setColor(fontColor.getIndex());
        }
    }
}

From source file:br.com.tecsinapse.exporter.style.TableCellStyle.java

License:LGPL

private void configFont(Font font) {
    font.setBold(isBold());/*from   w  w w.  ja va 2s .  c  o m*/
    font.setItalic(isItalic());
    font.setStrikeout(isStrikeout());
    font.setUnderline(isUnderline() ? Font.U_SINGLE : Font.U_NONE);
    if (getFontSize() != null) {
        font.setFontHeightInPoints(fontSize.shortValue());
    }
    if (getFontColor() != null) {
        font.setColor(fontColor.getIndex());
    }
}

From source file:com.canoo.webtest.plugins.exceltest.ExcelVerifyCellStyle.java

License:Open Source License

private static String getFontStyle(final Font font) {
    final StringBuffer sb = new StringBuffer();
    if (font.getBoldweight() == Font.BOLDWEIGHT_BOLD) {
        sb.append("bold ");
    }//w w  w  .  j  a  v  a2s. co m
    if (font.getItalic()) {
        sb.append("italic ");
    }
    if (font.getStrikeout()) {
        sb.append("strikethrough ");
    }
    if (font.getTypeOffset() == Font.SS_SUB) {
        sb.append("subscript ");
    } else if (font.getTypeOffset() == Font.SS_SUPER) {
        sb.append("superscript ");
    }
    switch (font.getUnderline()) {
    case Font.U_NONE:
        break;
    case Font.U_SINGLE:
        sb.append("underline ");
        break;
    case Font.U_SINGLE_ACCOUNTING:
        sb.append("underline-accounting ");
        break;
    case Font.U_DOUBLE:
        sb.append("underline-double ");
        break;
    case Font.U_DOUBLE_ACCOUNTING:
        sb.append("underline-double-accounting ");
        break;
    default:
        sb.append("underline-unknown ");
        break;
    }
    if (sb.length() == 0) {
        return "normal";
    }
    return sb.substring(0, sb.length() - 1);
}

From source file:com.dua3.meja.model.poi.PoiWorkbook.java

License:Apache License

PoiFont getPoiFont(com.dua3.meja.model.Font font, Style style) {
    Map<String, String> properties = style.properties();

    if (properties.isEmpty() && font instanceof PoiFont && ((PoiFont) font).workbook == this) {
        return (PoiFont) font;
    }/*from ww  w  .java 2s .c o  m*/

    // FIXME JDK 8 
    // String name = properties.getOrDefault(Style.FONT_FAMILY, font.getFamily());
    String name = properties.get(Style.FONT_FAMILY);
    if (name == null) {
        name = font.getFamily();
    }

    String sSize = properties.get(Style.FONT_SIZE);
    short height = (short) Math
            .round(sSize == null ? font.getSizeInPoints() : MejaHelper.decodeFontSize(sSize));

    final String sStyle = properties.get(Style.FONT_STYLE);
    boolean italic = sStyle == null ? font.isItalic() : "italic".equals(sStyle);

    final String sWeight = properties.get(Style.FONT_WEIGHT);
    boolean bold = sWeight == null ? font.isBold() : "bold".equals(sWeight);

    String sDecoration = properties.get(Style.TEXT_DECORATION);
    boolean underline = sDecoration == null ? font.isUnderlined() : "underline".equals(sDecoration);
    boolean strikethrough = sDecoration == null ? font.isStrikeThrough() : "line-through".equals(sDecoration);

    String sColor = properties.get(Style.COLOR);
    Color color = sColor == null ? font.getColor() : Color.valueOf(sColor);

    // try to find existing font
    for (short i = 0; i < poiWorkbook.getNumberOfFonts(); i++) {
        Font poiFont = poiWorkbook.getFontAt(i);

        if (poiFont.getFontName().equalsIgnoreCase(name) && poiFont.getFontHeightInPoints() == height
                && poiFont.getBold() == bold && poiFont.getItalic() == italic
                && (poiFont.getUnderline() != Font.U_NONE) == underline
                && poiFont.getStrikeout() == strikethrough && getColor(poiFont, Color.BLACK).equals(color)
                && poiFont.getTypeOffset() == Font.SS_NONE) {
            return new PoiFont(this, poiFont);
        }
    }

    // if not found, create it
    return createFont(name, height, font.getColor(), bold, italic, underline, strikethrough);
}

From source file:com.globalsight.everest.qachecks.DITAQAChecker.java

License:Apache License

private void addTitle(Workbook p_workBook, Sheet p_sheet) throws Exception {
    Font titleFont = p_workBook.createFont();
    titleFont.setUnderline(Font.U_NONE);
    titleFont.setFontName("Times");
    titleFont.setFontHeightInPoints((short) 14);
    titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    CellStyle cs = p_workBook.createCellStyle();
    cs.setFont(titleFont);/*from   w w  w.j a  va2 s  .  c o m*/

    Row titleRow = getRow(p_sheet, 0);
    Cell titleCell = getCell(titleRow, 0);
    titleCell.setCellValue("DITA QA Report");
    titleCell.setCellStyle(cs);
}

From source file:com.globalsight.everest.qachecks.DITAQAChecker.java

License:Apache License

private CellStyle getHeaderStyle(Workbook p_workbook) throws Exception {
    if (headerStyle == null) {
        Font font = p_workbook.createFont();
        font.setBoldweight(Font.BOLDWEIGHT_BOLD);
        font.setColor(IndexedColors.BLACK.getIndex());
        font.setUnderline(Font.U_NONE);
        font.setFontName("Times");
        font.setFontHeightInPoints((short) 11);

        CellStyle cs = p_workbook.createCellStyle();
        cs.setFont(font);//from  w w w  .  j a v a 2s.  c  om
        cs.setWrapText(true);
        cs.setFillPattern(CellStyle.SOLID_FOREGROUND);
        cs.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
        cs.setBorderTop(CellStyle.BORDER_THIN);
        cs.setBorderRight(CellStyle.BORDER_THIN);
        cs.setBorderBottom(CellStyle.BORDER_THIN);
        cs.setBorderLeft(CellStyle.BORDER_THIN);

        headerStyle = cs;
    }

    return headerStyle;
}

From source file:com.globalsight.everest.qachecks.QAChecker.java

License:Apache License

private CellStyle getTitleStyle(Workbook p_workbook) {
    if (m_titleStyle == null) {
        CellStyle style = p_workbook.createCellStyle();
        Font font = p_workbook.createFont();
        font.setUnderline(Font.U_NONE);
        font.setFontName("Times");
        font.setFontHeightInPoints((short) 14);
        font.setBoldweight(Font.BOLDWEIGHT_BOLD);
        style.setFont(font);/*w  w w.  j  ava2 s  .co m*/

        m_titleStyle = style;
    }

    return m_titleStyle;
}

From source file:com.globalsight.everest.qachecks.QAChecker.java

License:Apache License

private CellStyle getHeaderStyle(Workbook p_workbook) {
    if (m_headerStyle == null) {
        Font font = p_workbook.createFont();
        font.setBoldweight(Font.BOLDWEIGHT_BOLD);
        font.setColor(IndexedColors.BLACK.getIndex());
        font.setUnderline(Font.U_NONE);
        font.setFontName("Times");
        font.setFontHeightInPoints((short) 11);

        CellStyle cs = p_workbook.createCellStyle();
        cs.setFont(font);//  w w  w. java  2  s.c om
        cs.setWrapText(true);
        cs.setFillPattern(CellStyle.SOLID_FOREGROUND);
        cs.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
        cs.setBorderTop(CellStyle.BORDER_THIN);
        cs.setBorderRight(CellStyle.BORDER_THIN);
        cs.setBorderBottom(CellStyle.BORDER_THIN);
        cs.setBorderLeft(CellStyle.BORDER_THIN);

        m_headerStyle = cs;
    }

    return m_headerStyle;
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.reports.CommentXlsReportHelper.java

License:Apache License

private void addTitle(Workbook p_workbook, Sheet p_sheet, String sheetTitle) throws Exception {
    // title font is black bold on white
    Font titleFont = p_workbook.createFont();
    titleFont.setUnderline(Font.U_NONE);
    titleFont.setFontName("Times");
    titleFont.setFontHeightInPoints((short) 14);
    titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
    CellStyle titileCs = p_workbook.createCellStyle();
    titileCs.setWrapText(false);// w  w  w  .j  a v a  2  s.  c  o  m
    titileCs.setFont(titleFont);

    Row titleRow = getRow(p_sheet, 0);
    Cell titleCell = getCell(titleRow, 0);
    titleCell.setCellValue(sheetTitle);
    titleCell.setCellStyle(titileCs);
    p_sheet.setColumnWidth(0, 22 * 256);
}