本文整理了Java中org.apache.poi.hssf.usermodel.HSSFWorkbook.getNumberOfFonts()
方法的一些代码示例,展示了HSSFWorkbook.getNumberOfFonts()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HSSFWorkbook.getNumberOfFonts()
方法的具体详情如下:
包路径:org.apache.poi.hssf.usermodel.HSSFWorkbook
类名称:HSSFWorkbook
方法名:getNumberOfFonts
[英]get the number of fonts in the font table
[中]获取字体表中的字体数
代码示例来源: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.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
/**
* 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.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;
}
内容来源于网络,如有侵权,请联系作者删除!