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

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

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

Font.getIndex介绍

[英]get the index within the XSSFWorkbook (sequence within the collection of Font objects)
[中]获取XSSF工作簿中的索引(字体对象集合中的顺序)

代码示例

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

/**
 * Applies a font to the specified characters of a string.
 *
 * @param startIndex    The start index to apply the font to (inclusive)
 * @param endIndex      The end index to apply to font to (exclusive)
 * @param font          The index of the font to use.
 */
public void applyFont(int startIndex, int endIndex, Font font)
{
  applyFont(startIndex, endIndex, font.getIndex());
}

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

/**
 * Applies a font to the specified characters of a string.
 *
 * @param startIndex    The start index to apply the font to (inclusive)
 * @param endIndex      The end index to apply to font to (exclusive)
 * @param font          The index of the font to use.
 */
public void applyFont(int startIndex, int endIndex, Font font)
{
  applyFont(startIndex, endIndex, font.getIndex());
}

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

/**
 * Take a cell, and apply a font to it
 *
 *@param cell the cell to set the alignment for
 *@param workbook The workbook that is being worked with.
 *@param font The Font that you want to set...
 */
public static void setFont(Cell cell, Workbook workbook, Font font) {
  setCellStyleProperty(cell, workbook, FONT, font.getIndex());
}

代码示例来源:origin: com.haulmont.thirdparty/poi

/**
 * Take a cell, and apply a font to it
 *
 *@param cell the cell to set the alignment for
 *@param workbook The workbook that is being worked with.
 *@param font The Font that you want to set...
 */
public static void setFont(Cell cell, Workbook workbook, Font font) {
  setCellStyleProperty(cell, workbook, FONT, font.getIndex());
}

代码示例来源:origin: eu.ralph-schuster/csv

/**
 * {@inheritDoc}
 */
@Override
public String toString() {
  StringBuilder rc = new StringBuilder();
  rc.append(getFgColor()); rc.append(':');
  rc.append(getFillPattern()); rc.append(':');
  rc.append(getBgColor()); rc.append(':');
  Font font = getFont();
  if (font != null) {
    rc.append(font.getIndex());
  } else {
    rc.append("null");
  }
  rc.append(':');
  rc.append(getAlignment()); rc.append(':');
  rc.append(getTopBorderColor()); rc.append(':');
  rc.append(getTopBorderThickness()); rc.append(':');
  rc.append(getLeftBorderColor()); rc.append(':');
  rc.append(getLeftBorderThickness()); rc.append(':');
  rc.append(getRightBorderColor()); rc.append(':');
  rc.append(getRightBorderThickness()); rc.append(':');
  rc.append(getBottomBorderColor()); rc.append(':');
  rc.append(getBottomBorderThickness()); ; rc.append(':');
  rc.append(isTextWrap());
  return rc.toString();
}

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

/**
 * Set the font for this style
 *
 * @param font  a font object created or retreived from the XSSFWorkbook object
 * @see org.apache.poi.xssf.usermodel.XSSFWorkbook#createFont()
 * @see org.apache.poi.xssf.usermodel.XSSFWorkbook#getFontAt(short)
 */
public void setFont(Font font) {
  if(font != null){
    long index = font.getIndex();
    this._cellXf.setFontId(index);
    this._cellXf.setApplyFont(true);
  } else {
    this._cellXf.setApplyFont(false);
  }
}

代码示例来源: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: zhangdaiscott/jeasypoi

/**
 * 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() + "");
  }
}

代码示例来源:origin: xiaolanglang/easypoi

/**
 * 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() + "");
  }
}

代码示例来源:origin: org.jeecg/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.getBoldweight() + "_" + font.getItalic() + "_" + font.getFontName()
           + "_" + font.getFontHeightInPoints() + "_" + font.getColor(),
      font.getIndex() + "");
  }
}

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

new HSSFFontWrapper( contentStyle, fontColorProducer.getNearestColor( textColor ) );
final Font excelFont = fontFactory.getExcelFont( wrapper );
this.font = excelFont.getIndex();

相关文章