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


Java HSSFFont.setBoldweight方法代码示例

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


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

示例1: createColumnHeaders

import org.apache.poi.hssf.usermodel.HSSFFont; //导入方法依赖的package包/类
/**
 */
protected void createColumnHeaders() {
	final HSSFRow headersRow = this.sheet.createRow(0);
	final HSSFFont font = this.workbook.createFont();
	font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
	final HSSFCellStyle style = this.workbook.createCellStyle();
	style.setFont(font);
	style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
	int counter = 1;
	for (int i = 0; i < this.model.getColumnCount(); i++) {
		final HSSFCell cell = headersRow.createCell(counter++);
		// cell.setEncoding(HSSFCell.ENCODING_UTF_16);
		cell.setCellValue(this.model.getColumnName(i));
		cell.setCellStyle(style);
	}
}
 
开发者ID:kiswanij,项目名称:jk-util,代码行数:18,代码来源:JKExcelUtil.java

示例2: generateContStyle

import org.apache.poi.hssf.usermodel.HSSFFont; //导入方法依赖的package包/类
/**
 * @Description: 生成excel表格 单元格内容的样式
 * @param workbook
 * @return
 *
 * @History
 *     1. 2014-12-19 linwb 创建方法
 */
private HSSFCellStyle generateContStyle(HSSFWorkbook workbook) {
    HSSFCellStyle cellStyle = workbook.createCellStyle();
    cellStyle.setFillForegroundColor(contCellBackgroundColor);
    cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
    
    cellStyle.setBorderBottom(contBorderBottom);
    cellStyle.setBorderLeft(contBorderLeft);
    cellStyle.setBorderRight(contBorderRight);
    cellStyle.setBorderTop(contBorderTop);
    cellStyle.setAlignment(contCellTextAlign);
    
    cellStyle.setVerticalAlignment(contCellVehicleAlign);
    // 生成字体
    HSSFFont font = workbook.createFont();
    font.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
    // 把字体应用到当前的样式
    cellStyle.setFont(font);
    
    return cellStyle;
}
 
开发者ID:webinglin,项目名称:excelExportor,代码行数:29,代码来源:ExcelExportor.java

示例3: estiloCabecalho

import org.apache.poi.hssf.usermodel.HSSFFont; //导入方法依赖的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

示例4: estiloDadosConsultado

import org.apache.poi.hssf.usermodel.HSSFFont; //导入方法依赖的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

示例5: estiloDadosRetorno

import org.apache.poi.hssf.usermodel.HSSFFont; //导入方法依赖的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

示例6: estiloCabecalho

import org.apache.poi.hssf.usermodel.HSSFFont; //导入方法依赖的package包/类
/**
 * Estilo de cabecalho.
 * @param wb 
 * @return retorna o estilo da celula.
 * @author Ekler Paulino de Mattos.
 */
private HSSFCellStyle estiloCabecalho(HSSFWorkbook wb){
	
	if(this.estiloCabecalho==null){
		this.estiloCabecalho = wb.createCellStyle();
		this.estiloCabecalho.setBorderBottom(HSSFCellStyle.BORDER_THIN);
		this.estiloCabecalho.setBorderRight(HSSFCellStyle.BORDER_THIN);
		this.estiloCabecalho.setBorderLeft(HSSFCellStyle.BORDER_THIN);
		this.estiloCabecalho.setBorderTop(HSSFCellStyle.BORDER_THIN);
		
		this.estiloCabecalho.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND );
	//	cellStyle.setFillForegroundColor(HSSFColor.GREY_40_PERCENT.index);
		this.estiloCabecalho.setFillForegroundColor(HSSFColor.LIGHT_YELLOW.index);
		
		this.estiloCabecalho.setAlignment(HSSFCellStyle.ALIGN_LEFT);
		
		HSSFFont font = this.estiloCabecalho.getFont(wb);
		font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
		font.setColor(HSSFFont.COLOR_NORMAL);
		font.setFontName(HSSFFont.FONT_ARIAL);
		this.estiloCabecalho.setFont(font);
	}
	
	return this.estiloCabecalho;
	
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:32,代码来源:GeradorXLSRetorno.java

示例7: writeCaption

import org.apache.poi.hssf.usermodel.HSSFFont; //导入方法依赖的package包/类
/**
 * @see org.displaytag.render.TableWriterTemplate#writeCaption(org.displaytag.model.TableModel)
 */
@Override
protected void writeCaption(TableModel model) throws Exception
{
    HSSFCellStyle style = this.wb.createCellStyle();
    HSSFFont bold = this.wb.createFont();
    bold.setBoldweight(Font.BOLDWEIGHT_BOLD);
    bold.setFontHeightInPoints((short) 14);
    style.setFont(bold);
    style.setAlignment(CellStyle.ALIGN_CENTER);

    this.colNum = 0;
    this.currentRow = this.sheet.createRow(this.sheetRowNum++);
    this.currentCell = this.currentRow.createCell(this.colNum);
    this.currentCell.setCellStyle(style);
    String caption = model.getCaption();
    this.currentCell.setCellValue(new HSSFRichTextString(caption));
    this.rowSpanTable(model);
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:22,代码来源:HssfTableWriter.java

示例8: initStili

import org.apache.poi.hssf.usermodel.HSSFFont; //导入方法依赖的package包/类
/**
   * ereditare questo metodo per modificare gli stili utilizzati
   */
  protected void initStili()
  {
HSSFFont fontGrassetto = _workBook.createFont();
fontGrassetto.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
fontGrassetto.setFontHeightInPoints((short) 10);

HSSFFont fontTesto = _workBook.createFont();
fontTesto.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL );
fontTesto.setFontHeightInPoints((short) 10);

_styleIntestazioni = _workBook.createCellStyle();
_styleIntestazioni.setFont(fontGrassetto);
_styleIntestazioni.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
_styleIntestazioni.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
_styleIntestazioni.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
_styleIntestazioni.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
_styleIntestazioni.setAlignment(HSSFCellStyle.ALIGN_CENTER);
_styleIntestazioni.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);

_styleTesto = _workBook.createCellStyle();
_styleTesto.setFont(fontTesto);
  }
 
开发者ID:giasap0,项目名称:konga,代码行数:26,代码来源:KBasic_ExcelWriter.java

示例9: setHeaderStyle

import org.apache.poi.hssf.usermodel.HSSFFont; //导入方法依赖的package包/类
private void setHeaderStyle(HSSFWorkbook wb) {
    HSSFCellStyle style = wb.createCellStyle();
    HSSFFont font = wb.createFont();
    font.setColor(HSSFColor.BLACK.index);
    font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
    font.setFontHeightInPoints((short) 8);
    style.setFont(font);
    style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    style.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
    style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
    style.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    style.setBorderRight(HSSFCellStyle.BORDER_THIN);
    style.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    style.setBorderTop(HSSFCellStyle.BORDER_THIN);
    style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
    style.setWrapText(true);
    headerStyle = style;
}
 
开发者ID:FenixEdu,项目名称:fenixedu-commons,代码行数:19,代码来源:ExcelStyle.java

示例10: setVerticalHeaderStyle

import org.apache.poi.hssf.usermodel.HSSFFont; //导入方法依赖的package包/类
private void setVerticalHeaderStyle(HSSFWorkbook wb) {
    verticalHeaderStyle = wb.createCellStyle();
    HSSFFont font = wb.createFont();
    font.setColor(HSSFColor.BLACK.index);
    font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
    font.setFontHeightInPoints((short) 8);
    verticalHeaderStyle.setFont(font);
    verticalHeaderStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);
    verticalHeaderStyle.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index);
    verticalHeaderStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
    verticalHeaderStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
    verticalHeaderStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
    verticalHeaderStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
    verticalHeaderStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
    verticalHeaderStyle.setRotation((short) 90);
}
 
开发者ID:FenixEdu,项目名称:fenixedu-commons,代码行数:17,代码来源:ExcelStyle.java

示例11: createHeader

import org.apache.poi.hssf.usermodel.HSSFFont; //导入方法依赖的package包/类
private void createHeader(
		HSSFWorkbook wb,
		HSSFSheet sheet,
		List<TascaDadaDto> informeCamps) {
	HSSFFont bold;
	bold = wb.createFont();
	bold.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
	bold.setColor(HSSFColor.WHITE.index);
	HSSFCellStyle headerStyle;
	headerStyle = wb.createCellStyle();
	headerStyle.setFillPattern(HSSFCellStyle.FINE_DOTS);
	headerStyle.setFillBackgroundColor(HSSFColor.GREY_80_PERCENT.index);
	headerStyle.setFont(bold);
	int rowNum = 0;
	int colNum = 0;
	// Capçalera
	HSSFRow xlsRow = sheet.createRow(rowNum++);
	HSSFCell cell;
	cell = xlsRow.createCell(colNum++);
	cell.setCellValue(new HSSFRichTextString(StringUtils.capitalize("Expedient")));
	cell.setCellStyle(headerStyle);
	for (TascaDadaDto camp : informeCamps) {
		sheet.autoSizeColumn(colNum);
		cell = xlsRow.createCell(colNum++);
		cell.setCellValue(new HSSFRichTextString(StringUtils.capitalize(camp.getCampEtiqueta())));
		cell.setCellStyle(headerStyle);
	}
}
 
开发者ID:GovernIB,项目名称:helium,代码行数:29,代码来源:ExpedientConsultaInformeController.java

示例12: setBold

import org.apache.poi.hssf.usermodel.HSSFFont; //导入方法依赖的package包/类
private static void setBold(HSSFWorkbook workbook, HSSFCell cell) {
  HSSFCellStyle boldStyle = workbook.createCellStyle();
  HSSFFont boldFont = workbook.createFont();
  boldFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
  boldStyle.setFont(boldFont);
  cell.setCellStyle(boldStyle);
}
 
开发者ID:innovad,项目名称:4mila-1.0,代码行数:8,代码来源:ExcelUtility.java

示例13: getFont

import org.apache.poi.hssf.usermodel.HSSFFont; //导入方法依赖的package包/类
private HSSFFont getFont(final boolean isHeader)
{
	HSSFFont font = null;
	if (isHeader)
	{
		if (m_fontHeader == null)
		{
			m_fontHeader = m_workbook.createFont();
			m_fontHeader.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
		}
		font = m_fontHeader;
	}
	else if (isFunctionRow())
	{
		font = m_workbook.createFont();
		font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
		font.setItalic(true);
	}
	else
	{
		if (m_fontDefault == null)
		{
			m_fontDefault = m_workbook.createFont();
		}
		font = m_fontDefault;
	}
	return font;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:29,代码来源:AbstractExcelExporter.java

示例14: generateHeaderStyle

import org.apache.poi.hssf.usermodel.HSSFFont; //导入方法依赖的package包/类
/**
 * Description: 生成表格的 头部的单元格样式
 * @param workbook
 * @return
 *
 * @History
 *     1. 2014-12-19 linwb 创建方法
 */
private HSSFCellStyle generateHeaderStyle(HSSFWorkbook workbook) {
    //生成表格头部标题栏样式
    HSSFCellStyle headerStyle = workbook.createCellStyle();
    // 设置这些样式
    headerStyle.setFillForegroundColor(headerCellBackgroundColor);
    headerStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
    
    headerStyle.setBorderBottom(headerBorderBottom);
    headerStyle.setBorderLeft(headerBorderLeft);
    headerStyle.setBorderRight(headerBorderRight);
    headerStyle.setBorderTop(headerBorderTop);
    
    headerStyle.setAlignment(headerCellTextAlign);
    headerStyle.setVerticalAlignment(headerCellVehicleAlign);
    
    // 生成字体
    HSSFFont font = workbook.createFont();
    font.setColor(headerFontColor);
    font.setFontHeightInPoints(headerFontHeight);
    font.setBoldweight(headerFontWeight);
    
    // 把字体应用到当前的样式
    headerStyle.setFont(font);
    
    return headerStyle;
}
 
开发者ID:webinglin,项目名称:excelExportor,代码行数:35,代码来源:ExcelExportor.java

示例15: estiloDadosConsultado

import org.apache.poi.hssf.usermodel.HSSFFont; //导入方法依赖的package包/类
/**
 * Estilo dos campos dos dados.
 * @param wb 
 * @return retorna o estilo da celula.
 * @author Ekler Paulino de Mattos.
 */
private HSSFCellStyle estiloDadosConsultado(HSSFWorkbook wb){
	if(this.estiloDadoConsultado==null){
		
		this.estiloDadoConsultado = wb.createCellStyle();
		this.estiloDadoConsultado.setBorderBottom(HSSFCellStyle.BORDER_THIN);
		this.estiloDadoConsultado.setBorderRight(HSSFCellStyle.BORDER_THIN);
		this.estiloDadoConsultado.setBorderLeft(HSSFCellStyle.BORDER_THIN);
		this.estiloDadoConsultado.setBorderTop(HSSFCellStyle.BORDER_THIN);
		
		// plano de fundo - para que funcione deve se  
		// definido antes um padrao de preenchimento.
		this.estiloDadoConsultado.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND );
		//cellStyle.setFillForegroundColor(HSSFColor.AQUA.index);
		this.estiloDadoConsultado.setFillForegroundColor(HSSFColor.WHITE.index);
		
		this.estiloDadoConsultado.setAlignment(HSSFCellStyle.ALIGN_LEFT);
		
		HSSFFont font = this.estiloDadoConsultado.getFont(wb);
		font.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);
		font.setColor(HSSFFont.COLOR_NORMAL);
		font.setFontName(HSSFFont.FONT_ARIAL);
		this.estiloDadoConsultado.setFont(font);
	}
	
	return this.estiloDadoConsultado;
	
}
 
开发者ID:darciopacifico,项目名称:omr,代码行数:34,代码来源:GeradorXLSRetorno.java


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