Example usage for org.apache.poi.xssf.usermodel XSSFFont setFamily

List of usage examples for org.apache.poi.xssf.usermodel XSSFFont setFamily

Introduction

In this page you can find the example usage for org.apache.poi.xssf.usermodel XSSFFont setFamily.

Prototype

public void setFamily(FontFamily family) 

Source Link

Document

set an enumeration representing the font family this font belongs to.

Usage

From source file:net.mcnewfamily.rmcnew.model.excel.FontEssence.java

License:Open Source License

public XSSFFont toXSSFFont(XSSFWorkbook workbook) {
    XSSFFont xssfFont = null;
    if (workbook != null) {
        xssfFont = workbook.createFont();
        xssfFont.setCharSet(FontCharset.DEFAULT);
        xssfFont.setFamily(this.fontFamily);
        xssfFont.setBold(this.bold);
        if (this.bold) {
            xssfFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
        } else {/*from   w ww.  j  a va2  s . c  o  m*/
            xssfFont.setBoldweight(Font.BOLDWEIGHT_NORMAL);
        }
        xssfFont.setItalic(this.italic);
        if (this.underline) {
            xssfFont.setUnderline(FontUnderline.SINGLE);
        }
        xssfFont.setStrikeout(this.strikeout);
        xssfFont.setColor(this.color);
        xssfFont.setFontHeightInPoints(this.fontHeightInPoints);
    } else {
        throw new IllegalArgumentException("Cannot create XSSFFont in a null XSSFWorkbook!");
    }
    return xssfFont;
}