org.apache.poi.ss.usermodel.Font.getBold()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(268)

本文整理了Java中org.apache.poi.ss.usermodel.Font.getBold()方法的一些代码示例,展示了Font.getBold()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Font.getBold()方法的具体详情如下:
包路径:org.apache.poi.ss.usermodel.Font
类名称:Font
方法名:getBold

Font.getBold介绍

暂无

代码示例

代码示例来源:origin: org.apache.poi/poi

/**
 * Copy text attributes from the supplied Font to Java2D AttributedString
 */
private static void copyAttributes(Font font, AttributedString str, @SuppressWarnings("SameParameterValue") int startIdx, int endIdx) {
  str.addAttribute(TextAttribute.FAMILY, font.getFontName(), startIdx, endIdx);
  str.addAttribute(TextAttribute.SIZE, (float)font.getFontHeightInPoints());
  if (font.getBold()) str.addAttribute(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD, startIdx, endIdx);
  if (font.getItalic() ) str.addAttribute(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE, startIdx, endIdx);
  if (font.getUnderline() == Font.U_SINGLE ) str.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON, startIdx, endIdx);
}

代码示例来源:origin: pentaho/pentaho-kettle

hlink_font.setBold( origFont.getBold() );
hlink_font.setCharSet( origFont.getCharSet() );
hlink_font.setFontHeight( origFont.getFontHeight() );

代码示例来源:origin: openl-tablets/openl-tablets

@Override
public boolean isBold() {
  return font.getBold();
}

代码示例来源:origin: stackoverflow.com

Workbook book = row.getSheet().getWorkbook();
CellStyle style = row.getCell(cellIndex).getCellStyle();
int fontIndex = style.getFontIndex();
Font font = book.getFontAt(fontIndex);
if (font.getBold()) {
  // if you are here, the font is bold
}

代码示例来源:origin: cn.afterturn/easypoi-base

private void fontStyle(Font font) {
  if (font.getBold()) {
    out.format("  font-weight: bold;%n");
  }
  if (font.getItalic()) {
    out.format("  font-style: italic;%n");
  }
  out.format("  font-family: %s;%n", font.getFontName());
  int fontheight = font.getFontHeightInPoints();
  if (fontheight == 9) {
    fontheight = 10;
  }
  out.format("  font-size: %dpt;%n", fontheight);
  helper.styleColor(out, "color", getColor(font));
}

代码示例来源:origin: org.apache.poi/poi-examples

private void fontStyle(CellStyle style) {
  Font font = wb.getFontAt(style.getFontIndexAsInt());
  if (font.getBold()) {
    out.format("  font-weight: bold;%n");
  }
  if (font.getItalic()) {
    out.format("  font-style: italic;%n");
  }
  int fontheight = font.getFontHeightInPoints();
  if (fontheight == 9) {
    //fix for stupid ol Windows
    fontheight = 10;
  }
  out.format("  font-size: %dpt;%n", fontheight);
  // Font color is handled with the other colors
}

代码示例来源:origin: cn.afterturn/easypoi-base

/**
 * O7 版本坑爹bug
 * @param wb
 */
private void cacheFontInfo(Workbook wb) {
  for (short i = 0, le = wb.getNumberOfFonts(); i < le; i++) {
    Font font = wb.getFontAt(i);
    fontCache.put(font.getBold() + "_" + font.getItalic() + "_" + font.getFontName()
           + "_" + font.getFontHeightInPoints() + "_" + font.getColor(),
      font.getIndex() + "");
  }
}

代码示例来源:origin: pentaho/pentaho-reporting

/**
 * Creates a HSSFFontWrapper for the excel font.
 *
 * @param font
 *          the font.
 */
public HSSFFontWrapper( final Font font ) {
 if ( font == null ) {
  throw new NullPointerException( "Font is null" );
 }
 if ( font.getColor() < 0 ) {
  throw new IllegalArgumentException( "Negative color index is not allowed" );
 }
 fontName = normalizeFontName( font.getFontName() );
 fontHeight = font.getFontHeightInPoints();
 bold = font.getBold();
 italic = font.getItalic();
 underline = ( font.getUnderline() != HSSFFont.U_NONE );
 strikethrough = font.getStrikeout();
 colorIndex = font.getColor();
}

代码示例来源:origin: openl-tablets/openl-tablets

public static void setCellFontUnderline(Cell cell, byte underline) {
  Font font = getCellFont(cell);
  setCellFont(cell,
      font.getBold(), font.getColor(), font.getFontHeight(), font.getFontName(), font.getItalic(),
      font.getStrikeout(), font.getTypeOffset(), underline);
}

代码示例来源:origin: openl-tablets/openl-tablets

public static void setCellFontItalic(Cell cell, boolean italic) {
  Font font = getCellFont(cell);
  setCellFont(cell,
      font.getBold(), font.getColor(), font.getFontHeight(), font.getFontName(), italic,
      font.getStrikeout(), font.getTypeOffset(), font.getUnderline());
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

/**
 * Copy text attributes from the supplied Font to Java2D AttributedString
 */
private static void copyAttributes(Font font, AttributedString str, @SuppressWarnings("SameParameterValue") int startIdx, int endIdx) {
  str.addAttribute(TextAttribute.FAMILY, font.getFontName(), startIdx, endIdx);
  str.addAttribute(TextAttribute.SIZE, (float)font.getFontHeightInPoints());
  if (font.getBold()) str.addAttribute(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD, startIdx, endIdx);
  if (font.getItalic() ) str.addAttribute(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE, startIdx, endIdx);
  if (font.getUnderline() == Font.U_SINGLE ) str.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON, startIdx, endIdx);
}

代码示例来源:origin: apache/metamodel

if (font.getBold()) {
  styleBuilder.bold();

代码示例来源:origin: org.apache.metamodel/MetaModel-excel

if (font.getBold()) {
  styleBuilder.bold();

代码示例来源:origin: openl-tablets/openl-tablets

public static Font cloneFontFrom(Cell cell) {
  Font newFont = null;
  if (cell != null) {
    Workbook workbook = cell.getSheet().getWorkbook();
    newFont = workbook.createFont();
    int fontIndex = cell.getCellStyle().getFontIndexAsInt();
    Font fromFont = workbook.getFontAt(fontIndex);
    newFont.setBold(fromFont.getBold());
    newFont.setColor(fromFont.getColor());
    newFont.setFontHeight(fromFont.getFontHeight());
    newFont.setFontName(fromFont.getFontName());
    newFont.setItalic(fromFont.getItalic());
    newFont.setStrikeout(fromFont.getStrikeout());
    newFont.setTypeOffset(fromFont.getTypeOffset());
    newFont.setUnderline(fromFont.getUnderline());
    newFont.setCharSet(fromFont.getCharSet());
  }
  return newFont;
}

相关文章