/** * get the color value for the font */ public HSSFColor getHSSFColor(HSSFWorkbook wb) { HSSFPalette pallette = wb.getCustomPalette(); return pallette.getColor( getColor() ); }
/** * Finds a font that matches the one with the supplied attributes */ @Override public HSSFFont findFont(boolean bold, short color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline) { int numberOfFonts = getNumberOfFontsAsInt(); for (int i = 0; i <= numberOfFonts; i++) { // Remember - there is no 4! if(i == 4) { continue; } HSSFFont hssfFont = getFontAt(i); if (hssfFont.getBold() == bold && hssfFont.getColor() == color && hssfFont.getFontHeight() == fontHeight && hssfFont.getFontName().equals(name) && hssfFont.getItalic() == italic && hssfFont.getStrikeout() == strikeout && hssfFont.getTypeOffset() == typeOffset && hssfFont.getUnderline() == underline) { return hssfFont; } } return null; }
/** * get the color value for the font */ public HSSFColor getHSSFColor(HSSFWorkbook wb) { HSSFPalette pallette = wb.getCustomPalette(); return pallette.getColor( getColor() ); }
/** * get the color value for the font */ public HSSFColor getHSSFColor(HSSFWorkbook wb) { HSSFPalette pallette = wb.getCustomPalette(); return pallette.getColor( getColor() ); }
/** * get the color value for the font */ public HSSFColor getHSSFColor(HSSFWorkbook wb) { HSSFPalette pallette = wb.getCustomPalette(); return pallette.getColor( getColor() ); }
void buildStyle_font( HSSFWorkbook workbook, StringBuilder style, HSSFFont font ) { if ( font.getBold() ) { style.append( "font-weight:bold;" ); } final HSSFColor fontColor = workbook.getCustomPalette().getColor( font.getColor() ); if ( fontColor != null ) style.append("color: ").append(ExcelToHtmlUtils.getColor(fontColor)).append("; "); if ( font.getFontHeightInPoints() != 0 ) style.append("font-size:").append(font.getFontHeightInPoints()).append("pt;"); if ( font.getItalic() ) { style.append( "font-style:italic;" ); } }
public void colorStyles(CellStyle style, Formatter out) { HSSFCellStyle cs = (HSSFCellStyle) style; out.format(" /* fill pattern = %d */%n", cs.getFillPattern()); styleColor(out, "background-color", cs.getFillForegroundColor()); styleColor(out, "color", colors.getColor(cs.getFont(wb).getColor())); }
void buildStyle_font( HSSFWorkbook workbook, StringBuilder style, HSSFFont font ) { switch ( font.getBoldweight() ) { case HSSFFont.BOLDWEIGHT_BOLD: style.append( "font-weight:bold;" ); break; case HSSFFont.BOLDWEIGHT_NORMAL: // by default, not not increase HTML size // style.append( "font-weight: normal; " ); break; } final HSSFColor fontColor = workbook.getCustomPalette().getColor( font.getColor() ); if ( fontColor != null ) style.append( "color: " + ExcelToHtmlUtils.getColor( fontColor ) + "; " ); if ( font.getFontHeightInPoints() != 0 ) style.append( "font-size:" + font.getFontHeightInPoints() + "pt;" ); if ( font.getItalic() ) { style.append( "font-style:italic;" ); } }
public void colorStyles(CellStyle style, Formatter out) { HSSFCellStyle cs = (HSSFCellStyle) style; out.format(" /* fill pattern = %d */%n", cs.getFillPattern()); styleColor(out, "background-color", cs.getFillForegroundColor()); styleColor(out, "color", colors.getColor(cs.getFont(wb).getColor())); }
public void colorStyles(CellStyle style, Formatter out) { HSSFCellStyle cs = (HSSFCellStyle) style; out.format(" /* fill pattern = %d */%n", cs.getFillPattern()); styleColor(out, "background-color", cs.getFillForegroundColor()); styleColor(out, "color", colors.getColor(cs.getFont(wb).getColor())); }
@Override public void colorStyles(CellStyle style, Formatter out) { HSSFCellStyle cs = (HSSFCellStyle) style; if (cs.getFillPattern() != FillPatternType.NO_FILL) { out.format(" /* fill pattern = %s */%n", cs.getFillPattern()); } styleColor(out, "background-color", cs.getFillForegroundColor()); styleColor(out, "color", colors.getColor(cs.getFont(wb).getColor())); }
protected void processCellStyleFont( HSSFWorkbook workbook, Element blockTarget, HSSFFont font ) { Triplet triplet = new Triplet(); triplet.fontName = font.getFontName(); triplet.bold = font.getBold(); triplet.italic = font.getItalic(); getFontReplacer().update( triplet ); setBlockProperties( blockTarget, triplet ); final HSSFColor fontColor = workbook.getCustomPalette().getColor( font.getColor() ); if ( fontColor != null ) blockTarget.setAttribute( "color", ExcelToHtmlUtils.getColor( fontColor ) ); if ( font.getFontHeightInPoints() != 0 ) blockTarget.setAttribute( "font-size", font.getFontHeightInPoints() + "pt" ); }
/** * Finds a font that matches the one with the supplied attributes */ public HSSFFont findFont(short boldWeight, short color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline) { for (short i=0; i<=getNumberOfFonts(); i++) { // Remember - there is no 4! if(i == 4) continue; HSSFFont hssfFont = getFontAt(i); if (hssfFont.getBoldweight() == boldWeight && hssfFont.getColor() == color && hssfFont.getFontHeight() == fontHeight && hssfFont.getFontName().equals(name) && hssfFont.getItalic() == italic && hssfFont.getStrikeout() == strikeout && hssfFont.getTypeOffset() == typeOffset && hssfFont.getUnderline() == underline) { return hssfFont; } } return null; }
/** * Finds a font that matches the one with the supplied attributes */ @Override public HSSFFont findFont(boolean bold, short color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline) { int numberOfFonts = getNumberOfFontsAsInt(); for (int i = 0; i <= numberOfFonts; i++) { // Remember - there is no 4! if(i == 4) { continue; } HSSFFont hssfFont = getFontAt(i); if (hssfFont.getBold() == bold && hssfFont.getColor() == color && hssfFont.getFontHeight() == fontHeight && hssfFont.getFontName().equals(name) && hssfFont.getItalic() == italic && hssfFont.getStrikeout() == strikeout && hssfFont.getTypeOffset() == typeOffset && hssfFont.getUnderline() == underline) { return hssfFont; } } return null; }
/** * Finds a font that matches the one with the supplied attributes */ public HSSFFont findFont(short boldWeight, short color, short fontHeight, String name, boolean italic, boolean strikeout, short typeOffset, byte underline) { for (short i=0; i<=getNumberOfFonts(); i++) { // Remember - there is no 4! if(i == 4) continue; HSSFFont hssfFont = getFontAt(i); if (hssfFont.getBoldweight() == boldWeight && hssfFont.getColor() == color && hssfFont.getFontHeight() == fontHeight && hssfFont.getFontName().equals(name) && hssfFont.getItalic() == italic && hssfFont.getStrikeout() == strikeout && hssfFont.getTypeOffset() == typeOffset && hssfFont.getUnderline() == underline) { return hssfFont; } } return null; }
@Override public void colorStyles(CellStyle style, Formatter out) { HSSFCellStyle cs = (HSSFCellStyle) style; out.format(" /* fill pattern = %d */%n", cs.getFillPattern().getCode()); styleColor(out, "background-color", cs.getFillForegroundColor()); styleColor(out, "color", cs.getFont(wb).getColor()); styleColor(out, "border-left-color", cs.getLeftBorderColor()); styleColor(out, "border-right-color", cs.getRightBorderColor()); styleColor(out, "border-top-color", cs.getTopBorderColor()); styleColor(out, "border-bottom-color", cs.getBottomBorderColor()); }
protected void processCellStyleFont( HSSFWorkbook workbook, Element blockTarget, HSSFFont font ) { Triplet triplet = new Triplet(); triplet.fontName = font.getFontName(); switch ( font.getBoldweight() ) { case HSSFFont.BOLDWEIGHT_BOLD: triplet.bold = true; break; case HSSFFont.BOLDWEIGHT_NORMAL: triplet.bold = false; break; } if ( font.getItalic() ) { triplet.italic = true; } getFontReplacer().update( triplet ); setBlockProperties( blockTarget, triplet ); final HSSFColor fontColor = workbook.getCustomPalette().getColor( font.getColor() ); if ( fontColor != null ) blockTarget.setAttribute( "color", ExcelToHtmlUtils.getColor( fontColor ) ); if ( font.getFontHeightInPoints() != 0 ) blockTarget.setAttribute( "font-size", font.getFontHeightInPoints() + "pt" ); }
} else editor.setBackground(white); editor.setForeground(getAWTColor(f.getColor(), black));
editor.setForeground(getAWTColor(f.getColor(), black));
newFont.setBoldweight(cellFont.getBoldweight()); newFont.setCharSet(cellFont.getCharSet()); newFont.setColor(cellFont.getColor()); newFont.setUnderline(cellFont.getUnderline()); newFont.setFontHeight(cellFont.getFontHeight());