List of usage examples for org.apache.poi.xssf.usermodel XSSFFont getUnderline
public byte getUnderline()
From source file:org.apache.metamodel.excel.XlsxSheetToRowsHandler.java
License:Apache License
private void configureStyle(XSSFCellStyle style) { XSSFFont font = style.getFont(); if (font.getBold()) { _style.bold();//www. j a v a 2 s.c o m } if (font.getItalic()) { _style.italic(); } if (font.getUnderline() != FontUnderline.NONE.getByteValue()) { _style.underline(); } if (style.getFillPatternEnum() == FillPatternType.SOLID_FOREGROUND) { XSSFColor fillForegroundXSSFColor = style.getFillForegroundXSSFColor(); String argb = fillForegroundXSSFColor.getARGBHex(); if (argb != null) { _style.background(argb.substring(2)); } } final XSSFFont stdFont = _stylesTable.getStyleAt(0).getFont(); final short fontHeight = style.getFont().getFontHeightInPoints(); if (stdFont.getFontHeightInPoints() != fontHeight) { _style.fontSize(fontHeight, SizeUnit.PT); } XSSFColor fontColor = style.getFont().getXSSFColor(); if (fontColor != null) { String argbHex = fontColor.getARGBHex(); if (argbHex != null) { _style.foreground(argbHex.substring(2)); } } switch (style.getAlignmentEnum()) { case LEFT: _style.leftAligned(); break; case RIGHT: _style.rightAligned(); break; case CENTER: _style.centerAligned(); break; case JUSTIFY: _style.justifyAligned(); break; default: // do nothing break; } }
From source file:org.sysmodb.xml.XSSFXMLStyleHelper.java
License:BSD License
public boolean areFontsEmpty(CellStyle style) { XSSFCellStyle newStyle = (XSSFCellStyle) style; XSSFFont font = newStyle.getFont(); 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; }//from w w w . j a va 2 s .c o m } 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(); if (font.getBold()) { xmlWriter.writeStartElement("font-weight"); xmlWriter.writeCharacters("bold"); xmlWriter.writeEndElement();// w w w . j a v a2s. c o m } 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(); } } }