src.getFont().getCTFont().toString(), DEFAULT_XML_OPTIONS ); XSSFFont font = new XSSFFont(ctFont);
@Override public void accept(final CellStyle style) { final Font font = ((XSSFCellStyle) style).getFont(); this.props.forEach( prop -> prop.accept(font) ); style.setFont(font); }
private void appendFontStyle(StringBuilder buffer, XSSFCellStyle style) { XSSFFont font = style.getFont(); buffer.append("font-size:").append(font.getFontHeightInPoints()).append("pt;"); if(font.getBold() || font.getBoldweight() == Font.BOLDWEIGHT_BOLD){ buffer.append( FONT_WEIGHT_BOLD ); } if(font.getItalic()){ buffer.append( FONT_STYLE_ITALIC ); } if(font.getUnderline() != Font.U_NONE){ buffer.append( TEXT_DECORATION_UNDERLINE ); } }
public byte getUnderline() { return cell.getCellStyle().getFont().getUnderline(); }
/** * Checks if cell font size matches. */ private void isCellFontSizeMatches(Locator loc1, Locator loc2) { if (!(loc1.cell instanceof XSSFCell)) return; short size1 = ((XSSFCell)loc1.cell).getCellStyle().getFont().getFontHeightInPoints(); short size2 = ((XSSFCell)loc2.cell).getCellStyle().getFont().getFontHeightInPoints(); if (size1 != size2) { addMessage(loc1, loc2, "Cell Font Size does not Match ::", Short.toString(size1), Short.toString(size2) ); } }
/** * Checks if cell font family matches. */ private void isCellFontFamilyMatches(Locator loc1, Locator loc2) { // TODO: Check for NPEs if (!(loc1.cell instanceof XSSFCell)) return; String family1 = ((XSSFCell)loc1.cell).getCellStyle().getFont().getFontName(); String family2 = ((XSSFCell)loc2.cell).getCellStyle().getFont().getFontName(); if (!family1.equals(family2)) { addMessage(loc1, loc2, "Cell Font Family does not Match ::", family1, family2); } }
/** * Checks if cell font bold matches. */ private void isCellFontBoldMatches(Locator loc1, Locator loc2) { if (!(loc1.cell instanceof XSSFCell)) return; boolean b1 = ((XSSFCell)loc1.cell).getCellStyle().getFont().getBold(); boolean b2 = ((XSSFCell)loc2.cell).getCellStyle().getFont().getBold(); if (b1 != b2) { addMessage(loc1, loc2, CELL_FONT_ATTRIBUTES_DOES_NOT_MATCH, (b1 ? "" : "NOT ")+"BOLD", (b2 ? "" : "NOT ")+"BOLD" ); } }
/** * Checks if cell font italics matches. */ private void isCellFontItalicsMatches(Locator loc1, Locator loc2) { if (!(loc1.cell instanceof XSSFCell)) return; boolean b1 = ((XSSFCell)loc1.cell).getCellStyle().getFont().getItalic(); boolean b2 = ((XSSFCell)loc2.cell).getCellStyle().getFont().getItalic(); if (b1 != b2) { addMessage(loc1, loc2, CELL_FONT_ATTRIBUTES_DOES_NOT_MATCH, (b1 ? "" : "NOT ")+"ITALICS", (b2 ? "" : "NOT ")+"ITALICS" ); } }
/** * Checks if cell under line matches. */ private void isCellUnderLineMatches(Locator loc1, Locator loc2) { // TOOO: distinguish underline type if (!(loc1.cell instanceof XSSFCell)) return; byte b1 = ((XSSFCell)loc1.cell).getCellStyle().getFont().getUnderline(); byte b2 = ((XSSFCell)loc2.cell).getCellStyle().getFont().getUnderline(); if (b1 != b2) { addMessage(loc1, loc2, CELL_FONT_ATTRIBUTES_DOES_NOT_MATCH, (b1 == 1 ? "" : "NOT ")+"UNDERLINE", (b2 == 1 ? "" : "NOT ")+"UNDERLINE" ); } } }
public int findFontSize() { return getCell().getCellStyle().getFont().getFontHeightInPoints(); }
public PDFont getFont() { return PDFHelper.findFont(getCell().getCellStyle().getFont()); }
public void colorStyles(CellStyle style, Formatter out) { XSSFCellStyle cs = (XSSFCellStyle) style; styleColor(out, "background-color", cs.getFillForegroundXSSFColor()); styleColor(out, "color", cs.getFont().getXSSFColor()); }
@Override public void colorStyles(CellStyle style, Formatter out) { XSSFCellStyle cs = (XSSFCellStyle) style; styleColor(out, "background-color", cs.getFillForegroundXSSFColor()); styleColor(out, "color", cs.getFont().getXSSFColor()); }
@Override public void colorStyles(CellStyle style, Formatter out) { XSSFCellStyle cs = (XSSFCellStyle) style; styleColor(out, "background-color", cs.getFillForegroundXSSFColor()); styleColor(out, "text-color", cs.getFont().getXSSFColor()); }
public void colorStyles(CellStyle style, Formatter out) { XSSFCellStyle cs = (XSSFCellStyle) style; styleColor(out, "background-color", cs.getFillForegroundXSSFColor()); styleColor(out, "color", cs.getFont().getXSSFColor()); }
public void colorStyles(CellStyle style, Formatter out) { XSSFCellStyle cs = (XSSFCellStyle) style; styleColor(out, "background-color", cs.getFillForegroundXSSFColor()); styleColor(out, "color", cs.getFont().getXSSFColor()); }
@Override public ICellFont getFont(int row, int column) { int index = cellIndexes[row - region.getTop()][column - region.getLeft()]; // For XSSF workbook isn't needed return new XlsCellFont(stylesTable.getStyleAt(index).getFont(), null); }
public Color getTextColor() { XSSFColor color = getCell().getCellStyle().getFont().getXSSFColor(); return color == null ? Color.BLACK : getColorHelper().getAwtColor(color); }
public float getMaxFontHeight() { return findMaxFontHeight(getFont(), getCell().getCellStyle().getFont().getFontHeightInPoints()); }
public float findTextLength(String value) { short fontHeightInPoints = getCell().getCellStyle().getFont().getFontHeightInPoints(); float length; try { length = getFont().getStringWidth(value) / 1000 * fontHeightInPoints; } catch (IOException e) { throw new ReportException(e); } return length; }