當前位置: 首頁>>代碼示例>>Java>>正文


Java HSSFFont.getBoldweight方法代碼示例

本文整理匯總了Java中org.apache.poi.hssf.usermodel.HSSFFont.getBoldweight方法的典型用法代碼示例。如果您正苦於以下問題:Java HSSFFont.getBoldweight方法的具體用法?Java HSSFFont.getBoldweight怎麽用?Java HSSFFont.getBoldweight使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.poi.hssf.usermodel.HSSFFont的用法示例。


在下文中一共展示了HSSFFont.getBoldweight方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getFontMetrics

import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
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,代碼行數:20,代碼來源:ExcelAutoColumnSizer.java

示例2: processCellStyleFont

import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
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,代碼行數:36,代碼來源:ExcelToFoConverter.java

示例3: buildStyle_font

import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
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,代碼行數:29,代碼來源:ExcelToHtmlConverter.java

示例4: getIsBold

import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
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,代碼行數:8,代碼來源:ExcelUtility.java


注:本文中的org.apache.poi.hssf.usermodel.HSSFFont.getBoldweight方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。