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

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

Introduction

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

Prototype

short DEFAULT_FONT_SIZE

To view the source code for org.apache.poi.xssf.usermodel XSSFFont DEFAULT_FONT_SIZE.

Click Source Link

Document

By default, Microsoft Office Excel 2007 uses the Calibri font in font size 11

Usage

From source file:org.sysmodb.xml.XSSFXMLStyleHelper.java

License:BSD License

public boolean areFontsEmpty(CellStyle style) {
    XSSFCellStyle newStyle = (XSSFCellStyle) style;
    XSSFFont font = newStyle.getFont();/*from  ww w  .ja va  2s  .co m*/
    if (font.getBold())
        return false;
    if (font.getItalic())
        return false;
    if (font.getUnderline() != XSSFFont.U_NONE)
        return false;
    if (font.getFontHeight() != XSSFFont.DEFAULT_FONT_SIZE)
        return false;
    if (!font.getFontName().equals(XSSFFont.DEFAULT_FONT_NAME))
        return false;
    if (font.getColor() != XSSFFont.DEFAULT_FONT_COLOR) {
        String colorString = getRGBString(font.getXSSFColor());
        if (colorString != null) {
            return false;
        }
    }
    return true;
}

From source file:org.sysmodb.xml.XSSFXMLStyleHelper.java

License:BSD License

@Override
public void writeFontProperties(XMLStreamWriter xmlWriter, CellStyle style) throws XMLStreamException {
    XSSFCellStyle newStyle = (XSSFCellStyle) style;
    XSSFFont font = newStyle.getFont();/*from w  ww  .  j  a  v  a  2s .com*/
    if (font.getBold()) {
        xmlWriter.writeStartElement("font-weight");
        xmlWriter.writeCharacters("bold");
        xmlWriter.writeEndElement();
    }
    if (font.getItalic()) {
        xmlWriter.writeStartElement("font-style");
        xmlWriter.writeCharacters("italics");
        xmlWriter.writeEndElement();
    }
    if (font.getUnderline() != XSSFFont.U_NONE) {
        xmlWriter.writeStartElement("text-decoration");
        xmlWriter.writeCharacters("underline");
        xmlWriter.writeEndElement();
    }
    if (font.getFontHeight() != XSSFFont.DEFAULT_FONT_SIZE) {
        xmlWriter.writeStartElement("font-size");
        xmlWriter.writeCharacters(String.valueOf(font.getFontHeightInPoints()) + "pt");
        xmlWriter.writeEndElement();
    }

    if (!font.getFontName().equals(XSSFFont.DEFAULT_FONT_NAME)) {
        xmlWriter.writeStartElement("font-family");
        xmlWriter.writeCharacters(String.valueOf(font.getFontName()));
        xmlWriter.writeEndElement();
    }
    if (font.getColor() != XSSFFont.DEFAULT_FONT_COLOR) {
        String colorString = getRGBString(font.getXSSFColor());
        if (colorString != null) {
            xmlWriter.writeStartElement("color");
            xmlWriter.writeCharacters(colorString);
            xmlWriter.writeEndElement();
        }
    }

}