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


Java HSSFCellStyle.getFont方法代碼示例

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


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

示例1: estiloCabecalho

import org.apache.poi.hssf.usermodel.HSSFCellStyle; //導入方法依賴的package包/類
/**
 * Estilo de cabecalho.
 * @param wb 
 * @return retorna o estilo da celula.
 * @author Ekler Paulino de Mattos.
 */
private HSSFCellStyle estiloCabecalho(HSSFWorkbook wb){
	
	HSSFCellStyle cellStyle = wb.createCellStyle();
	cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THICK);
	cellStyle.setBorderRight(HSSFCellStyle.BORDER_THICK);
	cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THICK);
	cellStyle.setBorderTop(HSSFCellStyle.BORDER_THICK);
	
	cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND );
//	cellStyle.setFillForegroundColor(HSSFColor.GREY_40_PERCENT.index);
	cellStyle.setFillForegroundColor(HSSFColor.LIGHT_YELLOW.index);
	
	cellStyle.setAlignment(HSSFCellStyle.ALIGN_LEFT);
	
	HSSFFont font = cellStyle.getFont(wb);
	font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
	font.setColor(HSSFFont.COLOR_NORMAL);
	font.setFontName(HSSFFont.FONT_ARIAL);
	cellStyle.setFont(font);
	
	return cellStyle;
	
}
 
開發者ID:darciopacifico,項目名稱:omr,代碼行數:30,代碼來源:GeradorXLSRetorno.java

示例2: estiloDadosConsultado

import org.apache.poi.hssf.usermodel.HSSFCellStyle; //導入方法依賴的package包/類
/**
 * Estilo dos campos dos dados.
 * @param wb 
 * @return retorna o estilo da celula.
 * @author Ekler Paulino de Mattos.
 */
private HSSFCellStyle estiloDadosConsultado(HSSFWorkbook wb){
	
	HSSFCellStyle cellStyle = wb.createCellStyle();
	cellStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
	cellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
	cellStyle.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
	cellStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
	
	// plano de fundo - para que funcione deve se  
	// definido antes um padrao de preenchimento.
	cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND );
	//cellStyle.setFillForegroundColor(HSSFColor.AQUA.index);
	cellStyle.setFillForegroundColor(HSSFColor.WHITE.index);
	
	cellStyle.setAlignment(HSSFCellStyle.ALIGN_LEFT);
	
	HSSFFont font = cellStyle.getFont(wb);
	font.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
	font.setColor(HSSFFont.COLOR_NORMAL);
	font.setFontName(HSSFFont.FONT_ARIAL);
	cellStyle.setFont(font);
	
	return cellStyle;
	
}
 
開發者ID:darciopacifico,項目名稱:omr,代碼行數:32,代碼來源:GeradorXLSRetorno.java

示例3: estiloDadosRetorno

import org.apache.poi.hssf.usermodel.HSSFCellStyle; //導入方法依賴的package包/類
/**
 * Estilo dos campos dos dados.
 * @param wb 
 * @return retorna o estilo da celula.
 * @author Ekler Paulino de Mattos.
 */
private HSSFCellStyle estiloDadosRetorno(HSSFWorkbook wb){
	
	HSSFCellStyle cellStyle = wb.createCellStyle();
	cellStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
	cellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
	cellStyle.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
	cellStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
	
	// plano de fundo - para que funcione deve se  
	// definido antes um padrao de preenchimento.
	cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND );
	//cellStyle.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
	cellStyle.setFillForegroundColor(HSSFColor.PALE_BLUE.index);
	
	cellStyle.setAlignment(HSSFCellStyle.ALIGN_LEFT);
	
	HSSFFont font = cellStyle.getFont(wb);
	font.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
	font.setColor(HSSFFont.COLOR_NORMAL);
	font.setFontName(HSSFFont.FONT_ARIAL);
	cellStyle.setFont(font);
	
	return cellStyle;
	
}
 
開發者ID:darciopacifico,項目名稱:omr,代碼行數:32,代碼來源:GeradorXLSRetorno.java

示例4: getCellStyleString

import org.apache.poi.hssf.usermodel.HSSFCellStyle; //導入方法依賴的package包/類
/**
 * HSSFスタイルの文字列表現を取得する
 * 
 * @param workbook ブック
 * @param cellStyle スタイル
 * @return スタイルの文字列表現
 */
private static String getCellStyleString( Workbook workbook, HSSFCellStyle cellStyle) {
    StringBuffer sb = new StringBuffer();
    if ( cellStyle != null) {
        HSSFFont font = cellStyle.getFont( workbook);
        // sb.append("FontIndex=").append( cellStyle.getFontIndex()).append( ",");
        sb.append( "Font=").append( getHSSFFontString( ( HSSFWorkbook) workbook, font)).append( ",");

        sb.append( "DataFormat=").append( cellStyle.getDataFormat()).append( ",");
        sb.append( "DataFormatString=").append( cellStyle.getDataFormatString()).append( ",");
        sb.append( "Hidden=").append( cellStyle.getHidden()).append( ",");
        sb.append( "Locked=").append( cellStyle.getLocked()).append( ",");
        sb.append( "Alignment=").append( cellStyle.getAlignment()).append( ",");
        sb.append( "WrapText=").append( cellStyle.getWrapText()).append( ",");
        sb.append( "VerticalAlignment=").append( cellStyle.getVerticalAlignment()).append( ",");
        sb.append( "Rotation=").append( cellStyle.getRotation()).append( ",");
        sb.append( "Indention=").append( cellStyle.getIndention()).append( ",");
        sb.append( "BorderLeft=").append( cellStyle.getBorderLeft()).append( ",");
        sb.append( "BorderRight=").append( cellStyle.getBorderRight()).append( ",");
        sb.append( "BorderTop=").append( cellStyle.getBorderTop()).append( ",");
        sb.append( "BorderBottom=").append( cellStyle.getBorderBottom()).append( ",");

        sb.append( "LeftBorderColor=").append( getHSSFColorString( ( HSSFWorkbook) workbook, cellStyle.getLeftBorderColor())).append( ",");
        sb.append( "RightBorderColor=").append( getHSSFColorString( ( HSSFWorkbook) workbook, cellStyle.getRightBorderColor())).append( ",");
        sb.append( "TopBorderColor=").append( getHSSFColorString( ( HSSFWorkbook) workbook, cellStyle.getTopBorderColor())).append( ",");
        sb.append( "BottomBorderColor=").append( getHSSFColorString( ( HSSFWorkbook) workbook, cellStyle.getBottomBorderColor())).append( ",");

        sb.append( "FillPattern=").append( cellStyle.getFillPattern()).append( ",");
        sb.append( "FillForegroundColor=").append( getHSSFColorString( ( HSSFWorkbook) workbook, cellStyle.getFillForegroundColor())).append( ",");
        sb.append( "FillBackgroundColor=").append( getHSSFColorString( ( HSSFWorkbook) workbook, cellStyle.getFillBackgroundColor()));
    }
    return sb.toString();
}
 
開發者ID:excella-core,項目名稱:excella-pdfexporter,代碼行數:40,代碼來源:ReportsTestUtil.java

示例5: getCellStyleString

import org.apache.poi.hssf.usermodel.HSSFCellStyle; //導入方法依賴的package包/類
private static String getCellStyleString( Workbook workbook, HSSFCellStyle cellStyle) {
    StringBuffer sb = new StringBuffer();
    if ( cellStyle != null) {
        HSSFFont font = cellStyle.getFont( workbook);
        // sb.append("FontIndex=").append( cellStyle.getFontIndex()).append( ",");
        sb.append( "Font=").append( getHSSFFontString( ( HSSFWorkbook) workbook, font)).append( ",");

        sb.append( "DataFormat=").append( cellStyle.getDataFormat()).append( ",");
        sb.append( "DataFormatString=").append( cellStyle.getDataFormatString()).append( ",");
        sb.append( "Hidden=").append( cellStyle.getHidden()).append( ",");
        sb.append( "Locked=").append( cellStyle.getLocked()).append( ",");
        sb.append( "Alignment=").append( cellStyle.getAlignmentEnum()).append( ",");
        sb.append( "WrapText=").append( cellStyle.getWrapText()).append( ",");
        sb.append( "VerticalAlignment=").append( cellStyle.getVerticalAlignmentEnum()).append( ",");
        sb.append( "Rotation=").append( cellStyle.getRotation()).append( ",");
        sb.append( "Indention=").append( cellStyle.getIndention()).append( ",");
        sb.append( "BorderLeft=").append( cellStyle.getBorderLeftEnum()).append( ",");
        sb.append( "BorderRight=").append( cellStyle.getBorderRightEnum()).append( ",");
        sb.append( "BorderTop=").append( cellStyle.getBorderTopEnum()).append( ",");
        sb.append( "BorderBottom=").append( cellStyle.getBorderBottomEnum()).append( ",");

        sb.append( "LeftBorderColor=").append( getHSSFColorString( ( HSSFWorkbook) workbook, cellStyle.getLeftBorderColor())).append( ",");
        sb.append( "RightBorderColor=").append( getHSSFColorString( ( HSSFWorkbook) workbook, cellStyle.getRightBorderColor())).append( ",");
        sb.append( "TopBorderColor=").append( getHSSFColorString( ( HSSFWorkbook) workbook, cellStyle.getTopBorderColor())).append( ",");
        sb.append( "BottomBorderColor=").append( getHSSFColorString( ( HSSFWorkbook) workbook, cellStyle.getBottomBorderColor())).append( ",");

        sb.append( "FillPattern=").append( cellStyle.getFillPatternEnum()).append( ",");
        sb.append( "FillForegroundColor=").append( getHSSFColorString( ( HSSFWorkbook) workbook, cellStyle.getFillForegroundColor())).append( ",");
        sb.append( "FillBackgroundColor=").append( getHSSFColorString( ( HSSFWorkbook) workbook, cellStyle.getFillBackgroundColor()));
    }
    return sb.toString();
}
 
開發者ID:excella-core,項目名稱:excella-core,代碼行數:33,代碼來源:TestUtil.java

示例6: getCellStyleString

import org.apache.poi.hssf.usermodel.HSSFCellStyle; //導入方法依賴的package包/類
/**
 * HSSFスタイルの文字列表現を取得する
 * 
 * @param workbook ブック
 * @param cellStyle スタイル
 * @return スタイルの文字列表現
 */
private static String getCellStyleString( Workbook workbook, HSSFCellStyle cellStyle) {
    StringBuffer sb = new StringBuffer();
    if ( cellStyle != null) {
        HSSFFont font = cellStyle.getFont( workbook);
        // sb.append("FontIndex=").append( cellStyle.getFontIndex()).append( ",");
        sb.append( "Font=").append( getHSSFFontString( ( HSSFWorkbook) workbook, font)).append( ",");

        sb.append( "DataFormat=").append( cellStyle.getDataFormat()).append( ",");
        sb.append( "DataFormatString=").append( cellStyle.getDataFormatString()).append( ",");
        sb.append( "Hidden=").append( cellStyle.getHidden()).append( ",");
        sb.append( "Locked=").append( cellStyle.getLocked()).append( ",");
        sb.append( "Alignment=").append( cellStyle.getAlignmentEnum()).append( ",");
        sb.append( "WrapText=").append( cellStyle.getWrapText()).append( ",");
        sb.append( "VerticalAlignment=").append( cellStyle.getVerticalAlignmentEnum()).append( ",");
        sb.append( "Rotation=").append( cellStyle.getRotation()).append( ",");
        sb.append( "Indention=").append( cellStyle.getIndention()).append( ",");
        sb.append( "BorderLeft=").append( cellStyle.getBorderLeftEnum()).append( ",");
        sb.append( "BorderRight=").append( cellStyle.getBorderRightEnum()).append( ",");
        sb.append( "BorderTop=").append( cellStyle.getBorderTopEnum()).append( ",");
        sb.append( "BorderBottom=").append( cellStyle.getBorderBottomEnum()).append( ",");

        sb.append( "LeftBorderColor=").append( getHSSFColorString( ( HSSFWorkbook) workbook, cellStyle.getLeftBorderColor())).append( ",");
        sb.append( "RightBorderColor=").append( getHSSFColorString( ( HSSFWorkbook) workbook, cellStyle.getRightBorderColor())).append( ",");
        sb.append( "TopBorderColor=").append( getHSSFColorString( ( HSSFWorkbook) workbook, cellStyle.getTopBorderColor())).append( ",");
        sb.append( "BottomBorderColor=").append( getHSSFColorString( ( HSSFWorkbook) workbook, cellStyle.getBottomBorderColor())).append( ",");

        sb.append( "FillPattern=").append( cellStyle.getFillPatternEnum()).append( ",");
        sb.append( "FillForegroundColor=").append( getHSSFColorString( ( HSSFWorkbook) workbook, cellStyle.getFillForegroundColor())).append( ",");
        sb.append( "FillBackgroundColor=").append( getHSSFColorString( ( HSSFWorkbook) workbook, cellStyle.getFillBackgroundColor()));
    }
    return sb.toString();
}
 
開發者ID:excella-core,項目名稱:excella-reports,代碼行數:40,代碼來源:ReportsTestUtil.java

示例7: processCellStyle

import org.apache.poi.hssf.usermodel.HSSFCellStyle; //導入方法依賴的package包/類
protected void processCellStyle( HSSFWorkbook workbook,
        HSSFCellStyle cellStyle, Element cellTarget, Element blockTarget )
{
    blockTarget.setAttribute( "white-space-collapse", "false" );
    {
        String textAlign = ExcelToFoUtils.getAlign( cellStyle
                .getAlignment() );
        if ( ExcelToFoUtils.isNotEmpty( textAlign ) )
            blockTarget.setAttribute( "text-align", textAlign );
    }

    if ( cellStyle.getFillPattern() == 0 )
    {
        // no fill
    }
    else if ( cellStyle.getFillPattern() == 1 )
    {
        final HSSFColor foregroundColor = cellStyle
                .getFillForegroundColorColor();
        if ( foregroundColor != null )
            cellTarget.setAttribute( "background-color",
                    ExcelToFoUtils.getColor( foregroundColor ) );
    }
    else
    {
        final HSSFColor backgroundColor = cellStyle
                .getFillBackgroundColorColor();
        if ( backgroundColor != null )
            cellTarget.setAttribute( "background-color",
                    ExcelToHtmlUtils.getColor( backgroundColor ) );
    }

    processCellStyleBorder( workbook, cellTarget, "top",
            cellStyle.getBorderTop(), cellStyle.getTopBorderColor() );
    processCellStyleBorder( workbook, cellTarget, "right",
            cellStyle.getBorderRight(), cellStyle.getRightBorderColor() );
    processCellStyleBorder( workbook, cellTarget, "bottom",
            cellStyle.getBorderBottom(), cellStyle.getBottomBorderColor() );
    processCellStyleBorder( workbook, cellTarget, "left",
            cellStyle.getBorderLeft(), cellStyle.getLeftBorderColor() );

    HSSFFont font = cellStyle.getFont( workbook );
    processCellStyleFont( workbook, blockTarget, font );

}
 
開發者ID:rmage,項目名稱:gnvc-ims,代碼行數:46,代碼來源:ExcelToFoConverter.java

示例8: buildStyle

import org.apache.poi.hssf.usermodel.HSSFCellStyle; //導入方法依賴的package包/類
protected String buildStyle( HSSFWorkbook workbook, HSSFCellStyle cellStyle )
{
    StringBuilder style = new StringBuilder();

    style.append( "white-space:pre-wrap;" );
    ExcelToHtmlUtils.appendAlign( style, cellStyle.getAlignment() );
    ExcelToHtmlUtils.appendVAlign( style, cellStyle.getVerticalAlignment());

    if ( cellStyle.getFillPattern() == 0 )
    {
        // no fill
    }
    else if ( cellStyle.getFillPattern() == 1 )
    {
        final HSSFColor foregroundColor = cellStyle
                .getFillForegroundColorColor();
        if ( foregroundColor != null )
            style.append( "background-color:"
                    + ExcelToHtmlUtils.getColor( foregroundColor ) + ";" );
    }
    else
    {
        final HSSFColor backgroundColor = cellStyle
                .getFillBackgroundColorColor();
        if ( backgroundColor != null )
            style.append( "background-color:"
                    + ExcelToHtmlUtils.getColor( backgroundColor ) + ";" );
    }
    style.append( "text-indent:"+ cellStyle.getIndention()*10+"px;" );

    buildStyle_border( workbook, style, "top", cellStyle.getBorderTop(),
            cellStyle.getTopBorderColor() );
    buildStyle_border( workbook, style, "right",
            cellStyle.getBorderRight(), cellStyle.getRightBorderColor() );
    buildStyle_border( workbook, style, "bottom",
            cellStyle.getBorderBottom(), cellStyle.getBottomBorderColor() );
    buildStyle_border( workbook, style, "left", cellStyle.getBorderLeft(),
            cellStyle.getLeftBorderColor() );

    HSSFFont font = cellStyle.getFont( workbook );
    buildStyle_font( workbook, style, font );

    return style.toString();
}
 
開發者ID:rmage,項目名稱:gnvc-ims,代碼行數:45,代碼來源:ExcelToHtmlConverter.java


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