org.apache.poi.hssf.usermodel.HSSFWorkbook.getFontAt()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(137)

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

HSSFWorkbook.getFontAt介绍

[英]Get the font at the given index number
[中]获取给定索引号处的字体

代码示例

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

@Override
@Deprecated
public HSSFFont getFontAt(short idx) {
  return getFontAt((int)idx);
}

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

/**
 * gets the font for this style
 * @param parentWorkbook The HSSFWorkbook that this style belongs to
 * @see org.apache.poi.hssf.usermodel.HSSFCellStyle#getFontIndexAsInt()
 * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(int)
 */
public HSSFFont getFont(org.apache.poi.ss.usermodel.Workbook parentWorkbook) {
  return ((HSSFWorkbook) parentWorkbook).getFontAt(getFontIndexAsInt());
}

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

/**
 * create a new Font and add it to the workbook's font table
 * @return new font object
 */
@Override
public HSSFFont createFont()
{
  /*FontRecord font =*/ workbook.createNewFont();
  int fontindex = getNumberOfFontsAsInt() - 1;
  if (fontindex > 3)
  {
    fontindex++;   // THERE IS NO FOUR!!
  }
  if(fontindex >= Short.MAX_VALUE){
    throw new IllegalArgumentException("Maximum number of fonts was exceeded");
  }
  // Ask getFontAt() to build it for us,
  //  so it gets properly cached
  return getFontAt(fontindex);
}

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

/**
 * 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;
}

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

@Override
@Deprecated
public HSSFFont getFontAt(short idx) {
  return getFontAt((int)idx);
}

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

/**
 * gets the font for this style
 * @param parentWorkbook The HSSFWorkbook that this style belongs to
 * @see org.apache.poi.hssf.usermodel.HSSFCellStyle#getFontIndex()
 * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(short)
 */
public HSSFFont getFont(org.apache.poi.ss.usermodel.Workbook parentWorkbook) {
  return ((HSSFWorkbook) parentWorkbook).getFontAt(getFontIndex());
}

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

/**
 * gets the font for this style
 * @param parentWorkbook The HSSFWorkbook that this style belongs to
 * @see org.apache.poi.hssf.usermodel.HSSFCellStyle#getFontIndex()
 * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(short)
 */
public HSSFFont getFont(org.apache.poi.ss.usermodel.Workbook parentWorkbook) {
  return ((HSSFWorkbook) parentWorkbook).getFontAt(getFontIndex());
}

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

/**
 * gets the font for this style
 * @param parentWorkbook The HSSFWorkbook that this style belongs to
 * @see org.apache.poi.hssf.usermodel.HSSFCellStyle#getFontIndexAsInt()
 * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(int)
 */
public HSSFFont getFont(org.apache.poi.ss.usermodel.Workbook parentWorkbook) {
  return ((HSSFWorkbook) parentWorkbook).getFontAt(getFontIndexAsInt());
}

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

/**
 * create a new Font and add it to the workbook's font table
 * @return new font object
 */
public HSSFFont createFont()
{
  FontRecord font = workbook.createNewFont();
  short fontindex = (short) (getNumberOfFonts() - 1);
  if (fontindex > 3)
  {
    fontindex++;   // THERE IS NO FOUR!!
  }
  if(fontindex == Short.MAX_VALUE){
    throw new IllegalArgumentException("Maximum number of fonts was exceeded");
  }
  // Ask getFontAt() to build it for us,
  //  so it gets properly cached
  return getFontAt(fontindex);
}

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

/**
 * create a new Font and add it to the workbook's font table
 * @return new font object
 */
public HSSFFont createFont()
{
  FontRecord font = workbook.createNewFont();
  short fontindex = (short) (getNumberOfFonts() - 1);
  if (fontindex > 3)
  {
    fontindex++;   // THERE IS NO FOUR!!
  }
  if(fontindex == Short.MAX_VALUE){
    throw new IllegalArgumentException("Maximum number of fonts was exceeded");
  }
  // Ask getFontAt() to build it for us,
  //  so it gets properly cached
  return getFontAt(fontindex);
}

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

/**
 * create a new Font and add it to the workbook's font table
 * @return new font object
 */
@Override
public HSSFFont createFont()
{
  /*FontRecord font =*/ workbook.createNewFont();
  int fontindex = getNumberOfFontsAsInt() - 1;
  if (fontindex > 3)
  {
    fontindex++;   // THERE IS NO FOUR!!
  }
  if(fontindex >= Short.MAX_VALUE){
    throw new IllegalArgumentException("Maximum number of fonts was exceeded");
  }
  // Ask getFontAt() to build it for us,
  //  so it gets properly cached
  return getFontAt(fontindex);
}

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

/**
 * 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;
}

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

/**
 * 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;
}

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

/**
 * 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;
}

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

if (cell != null) {
   HSSFCellStyle style = cell.getCellStyle();
   HSSFFont f = wb.getFontAt(style.getFontIndex());
   boolean isbold = f.getBoldweight() > HSSFFont.BOLDWEIGHT_NORMAL;
   boolean isitalics = f.getItalic();

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

if (cell != null) {
   HSSFCellStyle style = cell.getCellStyle();
   HSSFFont f = wb.getFontAt(style.getFontIndex());
   boolean isbold = f.getBoldweight() > HSSFFont.BOLDWEIGHT_NORMAL;
   boolean isitalics = f.getItalic();

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

if (cell != null) {
  HSSFCellStyle style = cell.getCellStyle();
  HSSFFont f = wb.getFontAt(style.getFontIndexAsInt());
  boolean isbold = f.getBold();
  boolean isitalics = f.getItalic();

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

HSSFFont f = wb.getFontAt(s.getFontIndex());
setFont(SVTableUtils.makeFont(f));

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

HSSFFont f = wb.getFontAt(s.getFontIndexAsInt());
setFont(SVTableUtils.makeFont(f));

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

HSSFFont f = wb.getFontAt(s.getFontIndex());
setFont(SVTableUtils.makeFont(f));

相关文章

HSSFWorkbook类方法