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

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

Introduction

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

Prototype


boolean getItalic();

Source Link

Document

get whether to use italics or not

Usage

From source file:sol.neptune.elisaboard.service.VPlanToHtml.java

License:Apache License

private void fontStyle(CellStyle style) {
    Font font = wb.getFontAt(style.getFontIndex());

    if (font.getBoldweight() >= HSSFFont.BOLDWEIGHT_NORMAL) {
        out.format("  font-weight: bold;%n");
    }/*from   www.j a v a  2 s  .co m*/
    if (font.getItalic()) {
        out.format("  font-style: italic;%n");
    }

    int fontheight = font.getFontHeightInPoints();
    if (fontheight == 9) {
        //fix for stupid ol Windows
        fontheight = 10;
    }
    out.format("  font-size: %dpt;%n", fontheight);

    // Font color is handled with the other colors
}

From source file:uk.co.certait.test.ExcelToHtmlConverter.java

License:Apache License

private void fontStyle(CellStyle style) {
    Font font = wb.getFontAt(style.getFontIndex());

    if (font.getBold()) {
        out.format("  font-weight: bold;%n");
    }/* w  ww  .  j  ava 2  s .c om*/
    if (font.getItalic()) {
        out.format("  font-style: italic;%n");
    }

    int fontheight = font.getFontHeightInPoints();
    if (fontheight == 9) {
        // fix for stupid ol Windows
        fontheight = 10;
    }
    out.format("  font-size: %dpt;%n", fontheight);

    // Font color is handled with the other colors
}

From source file:uk.co.spudsoft.birt.emitters.excel.StyleManagerUtils.java

License:Open Source License

/**
 * Add font details to an AttributedString.
 * @param attrString/*  ww w.j a v  a 2s. c  o m*/
 * The AttributedString to modify.
 * @param font
 * The font to take attributes from.
 * @param startIdx
 * The index of the first character to be attributed (inclusive).
 * @param endIdx
 * The index of the last character to be attributed (inclusive). 
 */
protected void addFontAttributes(AttributedString attrString, Font font, int startIdx, int endIdx) {
    attrString.addAttribute(TextAttribute.FAMILY, font.getFontName(), startIdx, endIdx);
    attrString.addAttribute(TextAttribute.SIZE, (float) font.getFontHeightInPoints(), startIdx, endIdx);
    if (font.getBoldweight() == Font.BOLDWEIGHT_BOLD)
        attrString.addAttribute(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD, startIdx, endIdx);
    if (font.getItalic())
        attrString.addAttribute(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE, startIdx, endIdx);
    if (font.getUnderline() == Font.U_SINGLE)
        attrString.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON, startIdx, endIdx);
}