当前位置: 首页>>代码示例>>Java>>正文


Java HSSFFont.BOLDWEIGHT_BOLD属性代码示例

本文整理汇总了Java中org.apache.poi.hssf.usermodel.HSSFFont.BOLDWEIGHT_BOLD属性的典型用法代码示例。如果您正苦于以下问题:Java HSSFFont.BOLDWEIGHT_BOLD属性的具体用法?Java HSSFFont.BOLDWEIGHT_BOLD怎么用?Java HSSFFont.BOLDWEIGHT_BOLD使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.poi.hssf.usermodel.HSSFFont的用法示例。


在下文中一共展示了HSSFFont.BOLDWEIGHT_BOLD属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFontMetrics

private FontMetrics getFontMetrics(HSSFFont hf){
    FontMetrics fm;
    Short pFont = new Short(hf.getIndex());

    fm = (FontMetrics) fontMetrics.get(pFont);
    if (fm == null) {
        int style;
        if((hf.getBoldweight() == HSSFFont.BOLDWEIGHT_BOLD) || hf.getItalic()) { style = 0; if(hf.getBoldweight() == HSSFFont.BOLDWEIGHT_BOLD) style ^= Font.BOLD; if(hf.getItalic()) style ^= Font.ITALIC; } else { style = Font.PLAIN; }
        Font f = new java.awt.Font(hf.getFontName(), style, hf.getFontHeightInPoints());

        if (graphics == null) {
            BufferedImage i = new BufferedImage(1, 1, BufferedImage.TYPE_BYTE_GRAY); graphics = i.createGraphics(); }

        fm = graphics.getFontMetrics(f);
        fontMetrics.put(pFont, fm);
    }

    return fm;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:19,代码来源:ExcelAutoColumnSizer.java

示例2: processCellStyleFont

protected void processCellStyleFont( HSSFWorkbook workbook,
        Element blockTarget, HSSFFont font )
{
    Triplet triplet = new Triplet();
    triplet.fontName = font.getFontName();

    switch ( font.getBoldweight() )
    {
    case HSSFFont.BOLDWEIGHT_BOLD:
        triplet.bold = true;
        break;
    case HSSFFont.BOLDWEIGHT_NORMAL:
        triplet.bold = false;
        break;
    }

    if ( font.getItalic() )
    {
        triplet.italic = true;
    }

    getFontReplacer().update( triplet );
    setBlockProperties( blockTarget, triplet );

    final HSSFColor fontColor = workbook.getCustomPalette().getColor(
            font.getColor() );
    if ( fontColor != null )
        blockTarget.setAttribute( "color",
                ExcelToHtmlUtils.getColor( fontColor ) );

    if ( font.getFontHeightInPoints() != 0 )
        blockTarget.setAttribute( "font-size", font.getFontHeightInPoints()*0.8
                + "pt" );

}
 
开发者ID:rmage,项目名称:gnvc-ims,代码行数:35,代码来源:ExcelToFoConverter.java

示例3: buildStyle_font

void buildStyle_font( HSSFWorkbook workbook, StringBuilder style,
        HSSFFont font )
{
    switch ( font.getBoldweight() )
    {
    case HSSFFont.BOLDWEIGHT_BOLD:
        style.append( "font-weight:bold;" );
        break;
    case HSSFFont.BOLDWEIGHT_NORMAL:
        // by default, not not increase HTML size
        // style.append( "font-weight: normal; " );
        break;
    }

    final HSSFColor fontColor = workbook.getCustomPalette().getColor(
            font.getColor() );
    if ( fontColor != null )
        style.append( "color: " + ExcelToHtmlUtils.getColor( fontColor )
                + "; " );

    if ( font.getFontHeightInPoints() != 0 )
        style.append( "font-size:" + font.getFontHeightInPoints()*0.65*scale + "pt;" );

    if ( font.getItalic() )
    {
        style.append( "font-style:italic;" );
    }
}
 
开发者ID:rmage,项目名称:gnvc-ims,代码行数:28,代码来源:ExcelToHtmlConverter.java

示例4: getIsBold

public static boolean getIsBold(HSSFWorkbook workbook, HSSFSheet sheet, int row, short col)
{
    HSSFCell cell = sheet.getRow(row).getCell(col);
    HSSFFont font = workbook.getFontAt(cell.getCellStyle().getFontIndex());

    return font.getBoldweight() == HSSFFont.BOLDWEIGHT_BOLD;
}
 
开发者ID:NCIP,项目名称:cadsr-semantic-tools,代码行数:7,代码来源:ExcelUtility.java


注:本文中的org.apache.poi.hssf.usermodel.HSSFFont.BOLDWEIGHT_BOLD属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。