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


Java HSSFFont.setFontName方法代碼示例

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


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

示例1: createHSSFCellStyle

import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
private HSSFCellStyle createHSSFCellStyle(Workbook wb, int[] bgColor, int[] fontColor, int fontSize) {
	HSSFWorkbook workbook = (HSSFWorkbook) wb;
	HSSFPalette palette = workbook.getCustomPalette();
	
	palette.setColorAtIndex((short) 9, (byte) fontColor[0], (byte) fontColor[1], (byte) fontColor[2]);
	palette.setColorAtIndex((short) 10, (byte) bgColor[0], (byte) bgColor[1], (byte) bgColor[2]);

	HSSFFont titleFont = workbook.createFont();
	titleFont.setCharSet(HSSFFont.DEFAULT_CHARSET);
	titleFont.setFontName("宋體");
	titleFont.setColor((short) 9);
	titleFont.setBold(true); 
	titleFont.setFontHeightInPoints((short) fontSize);

	HSSFCellStyle titleStyle = (HSSFCellStyle) createBorderCellStyle(workbook, true);
	titleStyle.setFont(titleFont);
	titleStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
	titleStyle.setFillForegroundColor((short) 10);
	titleStyle.setAlignment(HorizontalAlignment.CENTER);
	titleStyle.setVerticalAlignment(VerticalAlignment.CENTER);

	return titleStyle;
}
 
開發者ID:bsteker,項目名稱:bdf2,代碼行數:24,代碼來源:TitleStyleBuilder.java

示例2: createCellStyleForColumnHeading

import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
public static HSSFCellStyle createCellStyleForColumnHeading(HSSFWorkbook workBook) {
	HSSFCellStyle cellStyle = workBook.createCellStyle();
	HSSFFont fontObj = workBook.createFont();
	cellStyle.setBorderBottom(BorderStyle.THIN);
	cellStyle.setBorderTop(BorderStyle.THIN);
	cellStyle.setBorderLeft(BorderStyle.THIN);
	cellStyle.setBorderRight(BorderStyle.THIN);
	cellStyle.setWrapText(true);
	cellStyle.setAlignment(HorizontalAlignment.CENTER);
	cellStyle.setFillBackgroundColor(Short.valueOf("22").shortValue());
	cellStyle.setFillPattern(FillPatternType.BIG_SPOTS);
	cellStyle.setFillForegroundColor(Short.valueOf("22").shortValue());
	cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
	fontObj.setFontName("Calibri");
	fontObj.setFontHeightInPoints(Short.valueOf("12").shortValue());
	fontObj.setBold(true);
	fontObj.setColor(Short.valueOf("8").shortValue());
	cellStyle.setFont(fontObj);
	return cellStyle;
}
 
開發者ID:siteadmin,項目名稱:CCDA-Score-CARD,代碼行數:21,代碼來源:ScorecardExcelGenerator.java

示例3: createSecondTitleStyle

import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
private HSSFCellStyle createSecondTitleStyle(HSSFWorkbook wb){
	HSSFCellStyle style = wb.createCellStyle();
	style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
	style.setAlignment(HSSFCellStyle.ALIGN_LEFT);
	style.setBorderBottom(HSSFCellStyle.BORDER_NONE);
    style.setBorderLeft(HSSFCellStyle.BORDER_NONE);
    style.setBorderRight(HSSFCellStyle.BORDER_NONE);
    style.setBorderTop(HSSFCellStyle.BORDER_NONE);
	style.setWrapText(true);
	
	HSSFFont font = wb.createFont();
	//font.setFontHeightInPoints((short)20);
	font.setFontName("����");
	style.setFont(font);
	return style;
}
 
開發者ID:wallellen,項目名稱:wl,代碼行數:17,代碼來源:ExcelExcuter.java

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: createCellStyleForComRepNotSetUp

import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
public static HSSFCellStyle createCellStyleForComRepNotSetUp(HSSFWorkbook workBook) {
	HSSFCellStyle cellStyle = workBook.createCellStyle();
	HSSFFont fontObj = workBook.createFont();
	cellStyle.setAlignment(HorizontalAlignment.CENTER);
	fontObj.setFontName("Calibri");
	fontObj.setFontHeightInPoints(Short.valueOf("12").shortValue());
	fontObj.setBold(true);
	fontObj.setColor((short) 10);
	cellStyle.setFont(fontObj);
	return cellStyle;
}
 
開發者ID:siteadmin,項目名稱:CCDA-Score-CARD,代碼行數:12,代碼來源:ScorecardExcelGenerator.java

示例9: createCellStyleForComRepSetUp

import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
public static HSSFCellStyle createCellStyleForComRepSetUp(HSSFWorkbook workBook) {
	HSSFCellStyle cellStyle = workBook.createCellStyle();
	HSSFFont fontObj = workBook.createFont();
	cellStyle.setAlignment(HorizontalAlignment.CENTER);
	fontObj.setFontName("Calibri");
	fontObj.setFontHeightInPoints(Short.valueOf("12").shortValue());
	fontObj.setBold(true);
	fontObj.setColor((short) 17);
	cellStyle.setFont(fontObj);
	return cellStyle;
}
 
開發者ID:siteadmin,項目名稱:CCDA-Score-CARD,代碼行數:12,代碼來源:ScorecardExcelGenerator.java

示例10: createTitleStyle

import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
private HSSFCellStyle createTitleStyle(HSSFWorkbook wb){
	HSSFCellStyle style = wb.createCellStyle();
	style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
	style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
	
	style.setWrapText(true);
	
	HSSFFont font = wb.createFont();
	font.setFontHeightInPoints((short)20);
	font.setFontName("����");
	style.setFont(font);
	return style;
}
 
開發者ID:wallellen,項目名稱:wl,代碼行數:14,代碼來源:ExcelExcuter.java

示例11: 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

示例12: 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){
	
	if(this.cellStyle==null){
		this.cellStyle = wb.createCellStyle();
		cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
		cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
		cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
		cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
		
		// 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 this.cellStyle;
}
 
開發者ID:darciopacifico,項目名稱:omr,代碼行數:33,代碼來源:GeradorXLSRetorno.java

示例13: formatCell

import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
protected void formatCell(HSSFWorkbook workbook, HSSFCell cell) {
    HSSFFont hssfFont = workbook.createFont();
    hssfFont.setFontName(Font.MONOSPACED);
    hssfFont.setFontHeightInPoints((short) 9);
    HSSFCellStyle cellStyle = workbook.createCellStyle();
    cellStyle.setFont(hssfFont);
    cell.setCellStyle(cellStyle);
}
 
開發者ID:objektwerks,項目名稱:swing,代碼行數:9,代碼來源:Report.java

示例14: setHeaderStyle

import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
/**
 * Sets header style
 * @param worksheet the worksheet
 * @param fontName font name
 * @param fontColor font color
 * @param fontBoldweight font weight
 */
public static void setHeaderStyle(Worksheet worksheet, String fontName,
		short fontColor, short fontBoldweight) {
	HSSFWorkbook workbook = worksheet.getWorkbook();
	HSSFFont font = workbook.createFont();
	font.setFontName(fontName);
	font.setColor(fontColor);
	font.setBoldweight(fontBoldweight);
	HSSFCellStyle cellStyle = workbook.createCellStyle();
	cellStyle.setFont(font);
	worksheet.setCellStyle(cellStyle);
}
 
開發者ID:Impetus,項目名稱:jumbune,代碼行數:19,代碼來源:ExportUtil.java

示例15: postProcessXLS

import org.apache.poi.hssf.usermodel.HSSFFont; //導入方法依賴的package包/類
public void postProcessXLS(Object document) {  
    HSSFWorkbook wb = (HSSFWorkbook) document;  
    HSSFSheet sheet = wb.getSheetAt(0);  
    HSSFRow header = sheet.getRow(0);  
      
    HSSFCellStyle cellStyle = wb.createCellStyle();    
    cellStyle.setFillForegroundColor(HSSFColor.GREEN.index);  
    cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);  
      
    for(int i=0; i < header.getPhysicalNumberOfCells();i++) {  
        HSSFCell cell = header.getCell(i);  
          
        cell.setCellStyle(cellStyle);  
    }  
    
    Row row=sheet.createRow((short)sheet.getLastRowNum()+3);
    Cell cellDisclaimer = row.createCell(0);
    HSSFFont customFont= wb.createFont();
    customFont.setFontHeightInPoints((short)10);
    customFont.setFontName("Arial");
    customFont.setColor(IndexedColors.BLACK.getIndex());
    customFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
    customFont.setItalic(true);
    
    cellDisclaimer.setCellValue("Disclaimer");
    HSSFCellStyle cellStyleDisclaimer = wb.createCellStyle();
    cellStyleDisclaimer.setFont(customFont);
    cellDisclaimer.setCellStyle(cellStyleDisclaimer);
    
    Row row1=sheet.createRow(sheet.getLastRowNum()+2);
    Cell cellDisclaimerContent1 = row1.createCell(0);
    cellDisclaimerContent1.setCellValue("The information contained in this website is for information purposes only, and does not constitute, nor is it intended to constitute, the provision of financial product advice.");
    
    Row row2=sheet.createRow(sheet.getLastRowNum()+1);
    Cell cellDisclaimerContent2 = row2.createCell(0);
    cellDisclaimerContent2.setCellValue("This website is intended to track the investor account summary information,investments and transaction in a partcular period of time. ");
    
}
 
開發者ID:sudheerj,項目名稱:primefaces-blueprints,代碼行數:39,代碼來源:InvestmentSummaryController.java


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