org.apache.poi.ss.usermodel.Workbook#getFontAt ( )源码实例Demo

下面列出了org.apache.poi.ss.usermodel.Workbook#getFontAt ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: autopoi   文件: StylerHelper.java
private void prontFonts(Workbook wb) {
	for (short i = 0, le = wb.getNumberOfFonts(); i <= le; i++) {
		Font font = wb.getFontAt(i);
		out.format(".%s .%s {%n", DEFAULTS_CLASS, "font_" + i + "_" + cssRandom);
		fontStyle(font);
		out.format("}%n");
	}

}
 
源代码2 项目: autopoi   文件: CellValueHelper.java
/**
 * 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.getBoldweight() + "_" + font.getItalic() + "_" + font.getFontName() + "_" + font.getFontHeightInPoints() + "_" + font.getColor(), font.getIndex() + "");
	}

}
 
源代码3 项目: jeasypoi   文件: StylerHelper.java
private void prontFonts(Workbook wb) {
	for (short i = 0, le = wb.getNumberOfFonts(); i <= le; i++) {
		Font font = wb.getFontAt(i);
		out.format(".%s .%s {%n", DEFAULTS_CLASS, "font_" + i + "_" + cssRandom);
		fontStyle(font);
		out.format("}%n");
	}

}
 
源代码4 项目: jeasypoi   文件: CellValueHelper.java
/**
 * 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.getBoldweight() + "_" + font.getItalic() + "_" + font.getFontName() + "_" + font.getFontHeightInPoints() + "_" + font.getColor(), font.getIndex() + "");
	}

}
 
源代码5 项目: lams   文件: SheetUtil.java
/**
 * Get default character width using the Workbook's default font
 *
 * @param wb the workbook to get the default character width from
 * @return default character width in pixels
 */
@Internal
public static int getDefaultCharWidth(final Workbook wb) {
    Font defaultFont = wb.getFontAt((short) 0);

    AttributedString str = new AttributedString(String.valueOf(defaultChar));
    copyAttributes(defaultFont, str, 0, 1);
    TextLayout layout = new TextLayout(str.getIterator(), fontRenderContext);
    return (int) layout.getAdvance();
}
 
源代码6 项目: easypoi   文件: StylerHelper.java
private void prontFonts(Workbook wb) {
    for (short i = 0, le = wb.getNumberOfFonts(); i <= le; i++) {
        Font font = wb.getFontAt(i);
        out.format(".%s .%s {%n", DEFAULTS_CLASS, "font_" + i + "_" + cssRandom);
        fontStyle(font);
        out.format("}%n");
    }

}
 
源代码7 项目: easypoi   文件: CellValueHelper.java
/**
 * 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.getBoldweight() + "_" + font.getItalic() + "_" + font.getFontName()
                      + "_" + font.getFontHeightInPoints() + "_" + font.getColor(),
            font.getIndex() + "");
    }

}
 
源代码8 项目: pentaho-reporting   文件: ExcelFontFactory.java
/**
 * Constructor for ExcelFontFactory.
 *
 * @param workbook
 *          the workbook.
 */
public ExcelFontFactory( final Workbook workbook, final ExcelColorProducer colorProducer ) {
  if ( workbook == null ) {
    throw new NullPointerException();
  }
  if ( colorProducer == null ) {
    throw new NullPointerException();
  }

  this.fonts = new HashMap<HSSFFontWrapper, Font>();
  this.workbook = workbook;

  // read the fonts from the workbook ...
  // Funny one: Please note that the layout will be broken if the first
  // font is not 'Arial 10'.
  final short numberOfFonts = this.workbook.getNumberOfFonts();
  for ( int i = 0; i < numberOfFonts; i++ ) {
    final Font font = workbook.getFontAt( (short) i );
    this.fonts.put( new HSSFFontWrapper( font ), font );
  }

  // add the default font
  // this MUST be the first one, that is created.
  // oh, I hate Excel ...
  final HSSFFontWrapper wrapper =
      new HSSFFontWrapper( "Arial", (short) 10, false, false, false, false, colorProducer
          .getNearestColor( Color.black ) );
  getExcelFont( wrapper );
}