当前位置: 首页>>代码示例>>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;未经允许,请勿转载。