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


Java CellStyle.setFillForegroundColor方法代码示例

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


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

示例1: createIndentationCellStyle

import org.apache.poi.ss.usermodel.CellStyle; //导入方法依赖的package包/类
public CellStyle createIndentationCellStyle(Workbook workbook, int s) {
	CellStyle dataStyle1 = this.createBorderCellStyle(workbook, true);
	Font dataFont = workbook.createFont();
	dataFont.setColor((short) 12);
	dataFont.setFontHeightInPoints((short) 10);
	dataStyle1.setFillPattern(FillPatternType.SOLID_FOREGROUND);
	dataStyle1.setFillForegroundColor((short) 11);
	dataStyle1.setFont(dataFont);
	dataStyle1.setVerticalAlignment(VerticalAlignment.CENTER);
	dataStyle1.setAlignment(HorizontalAlignment.LEFT);
	dataStyle1.setIndention(Short.valueOf(String.valueOf((s))));
	return dataStyle1;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:14,代码来源:GridStyleBuilder.java

示例2: makeHeader

import org.apache.poi.ss.usermodel.CellStyle; //导入方法依赖的package包/类
private void makeHeader ( final List<Field> columns, final HSSFSheet sheet )
{
    final Font font = sheet.getWorkbook ().createFont ();
    font.setFontName ( "Arial" );
    font.setBoldweight ( Font.BOLDWEIGHT_BOLD );
    font.setColor ( HSSFColor.WHITE.index );

    final CellStyle style = sheet.getWorkbook ().createCellStyle ();
    style.setFont ( font );
    style.setFillForegroundColor ( HSSFColor.BLACK.index );
    style.setFillPattern ( PatternFormatting.SOLID_FOREGROUND );

    final HSSFRow row = sheet.createRow ( 0 );

    for ( int i = 0; i < columns.size (); i++ )
    {
        final Field field = columns.get ( i );

        final HSSFCell cell = row.createCell ( i );
        cell.setCellValue ( field.getHeader () );
        cell.setCellStyle ( style );
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:24,代码来源:ExportEventsImpl.java

示例3: defaultHeaderCellStyle

import org.apache.poi.ss.usermodel.CellStyle; //导入方法依赖的package包/类
/**
 * Returns the default header style. Obtained from:
 * http://svn.apache.org/repos/asf/poi
 * /trunk/src/examples/src/org/apache/poi/ss/examples/TimesheetDemo.java
 *
 * @param wb the wb
 * @return the cell style
 */
protected CellStyle defaultHeaderCellStyle(final Workbook wb) {
    CellStyle style;
    final Font monthFont = wb.createFont();
    monthFont.setFontHeightInPoints((short) 11);
    monthFont.setColor(IndexedColors.WHITE.getIndex());
    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.CENTER);
    style.setVerticalAlignment(VerticalAlignment.CENTER);
    style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
    style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    style.setFont(monthFont);
    style.setWrapText(true);
    return style;
}
 
开发者ID:TFyre,项目名称:vaadin-gridexport,代码行数:23,代码来源:ExcelExport.java

示例4: createStyles

import org.apache.poi.ss.usermodel.CellStyle; //导入方法依赖的package包/类
/**
     * 创建表格样式
     * @param wb 工作薄对象
     * @return 样式列表
     */
    private Map<String, CellStyle> createStyles(Workbook wb) {
        Map<String, CellStyle> styles = new HashMap<String, CellStyle>();

        CellStyle style = wb.createCellStyle();
        style.setAlignment(CellStyle.ALIGN_CENTER);
        style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
        Font titleFont = wb.createFont();
        titleFont.setFontName("Arial");
        titleFont.setFontHeightInPoints((short) 16);
        titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
        style.setFont(titleFont);
        styles.put("title", style);

        style = wb.createCellStyle();
        style.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
        style.setBorderRight(CellStyle.BORDER_THIN);
        style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
        style.setBorderLeft(CellStyle.BORDER_THIN);
        style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
        style.setBorderTop(CellStyle.BORDER_THIN);
        style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
        style.setBorderBottom(CellStyle.BORDER_THIN);
        style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
        Font dataFont = wb.createFont();
        dataFont.setFontName("Arial");
        dataFont.setFontHeightInPoints((short) 10);
        style.setFont(dataFont);
        styles.put("data", style);

        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
        style.setAlignment(CellStyle.ALIGN_LEFT);
        styles.put("data1", style);

        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
        style.setAlignment(CellStyle.ALIGN_CENTER);
        styles.put("data2", style);

        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
        style.setAlignment(CellStyle.ALIGN_RIGHT);
        styles.put("data3", style);

        style = wb.createCellStyle();
        style.cloneStyleFrom(styles.get("data"));
//		style.setWrapText(true);
        style.setAlignment(CellStyle.ALIGN_CENTER);
        style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
        style.setFillPattern(CellStyle.SOLID_FOREGROUND);
        Font headerFont = wb.createFont();
        headerFont.setFontName("Arial");
        headerFont.setFontHeightInPoints((short) 10);
        headerFont.setBoldweight(Font.BOLDWEIGHT_BOLD);
        headerFont.setColor(IndexedColors.WHITE.getIndex());
        style.setFont(headerFont);
        styles.put("header", style);

        return styles;
    }
 
开发者ID:sombie007,项目名称:ExcelHandle,代码行数:66,代码来源:ExportExcel.java

示例5: createStyles

import org.apache.poi.ss.usermodel.CellStyle; //导入方法依赖的package包/类
/**
 * excel 样式
 *
 * @return
 */
public Map<String, CellStyle> createStyles(Workbook workbook) {
    Map<String, CellStyle> styles = new HashMap();
    CellStyle style = workbook.createCellStyle();
    style.setAlignment((short) 2);
    style.setVerticalAlignment((short) 1);
    Font titleFont = workbook.createFont();
    titleFont.setFontName("Arial");
    titleFont.setFontHeightInPoints((short) 16);
    titleFont.setBoldweight((short) 700);
    style.setFont(titleFont);
    styles.put("title", style);
    style = workbook.createCellStyle();
    style.setVerticalAlignment((short) 1);
    style.setBorderRight((short) 1);
    style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
    style.setBorderLeft((short) 1);
    style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
    style.setBorderTop((short) 1);
    style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
    style.setBorderBottom((short) 1);
    style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex());
    Font dataFont = workbook.createFont();
    dataFont.setFontName("Arial");
    dataFont.setFontHeightInPoints((short) 10);
    style.setFont(dataFont);
    styles.put("data", style);
    style = workbook.createCellStyle();
    style.cloneStyleFrom((CellStyle) styles.get("data"));
    style.setAlignment((short) 1);
    styles.put("data1", style);
    style = workbook.createCellStyle();
    style.cloneStyleFrom((CellStyle) styles.get("data"));
    style.setAlignment((short) 2);
    styles.put("data2", style);
    style = workbook.createCellStyle();
    style.cloneStyleFrom((CellStyle) styles.get("data"));
    style.setAlignment((short) 3);
    styles.put("data3", style);
    style = workbook.createCellStyle();
    style.cloneStyleFrom((CellStyle) styles.get("data"));
    style.setAlignment((short) 2);
    style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex());
    style.setFillPattern((short) 1);
    Font headerFont = workbook.createFont();
    headerFont.setFontName("Arial");
    headerFont.setFontHeightInPoints((short) 10);
    headerFont.setBoldweight((short) 700);
    headerFont.setColor(IndexedColors.WHITE.getIndex());
    style.setFont(headerFont);
    styles.put("header", style);
    return styles;
}
 
开发者ID:zhangbiy,项目名称:exportExcel,代码行数:58,代码来源:ExcelTest.java

示例6: buildExcelDocument

import org.apache.poi.ss.usermodel.CellStyle; //导入方法依赖的package包/类
@Override
protected void buildExcelDocument(Map<String, Object> model,
		HSSFWorkbook workbook, HttpServletRequest request, HttpServletResponse response)
		throws Exception {
	// get data model which is passed by the Spring container
	List<RatingCountBean> listOfRating = (List<RatingCountBean>) model.get("listOfRatingCount");
	
	// create a new Excel sheet
	HSSFSheet sheet = workbook.createSheet("Feedback Report");
	sheet.setDefaultColumnWidth(30);
	
	// create style for header cells
	CellStyle style = workbook.createCellStyle();
	Font font = workbook.createFont();
	font.setFontName("Arial");
	style.setFillForegroundColor(HSSFColor.BLUE.index);
	style.setFillPattern(CellStyle.SOLID_FOREGROUND);
	font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
	font.setColor(HSSFColor.WHITE.index);
	style.setFont(font);
	
	// create header row
	HSSFRow header = sheet.createRow(0);
	
               
               header.createCell(0).setCellValue("Question Number");
	header.getCell(0).setCellStyle(style);
               
	header.createCell(1).setCellValue("Question");
	header.getCell(1).setCellStyle(style);
	
	header.createCell(2).setCellValue("Very Poor");
	header.getCell(2).setCellStyle(style);
	
	header.createCell(3).setCellValue("Poor");
	header.getCell(3).setCellStyle(style);
	
	header.createCell(4).setCellValue("Good");
	header.getCell(4).setCellStyle(style);
	
	header.createCell(5).setCellValue("Best");
	header.getCell(5).setCellStyle(style);
               
               header.createCell(6).setCellValue("Excellent");
	header.getCell(6).setCellStyle(style);
	
	// create data rows
	int rowCount = 1;
	
	for (RatingCountBean rating : listOfRating) {
		HSSFRow aRow = sheet.createRow(rowCount++);
		aRow.createCell(0).setCellValue(rating.getQuestionId());
		aRow.createCell(1).setCellValue(rating.getQuestionText());
		aRow.createCell(2).setCellValue(rating.getRating_one_total_count());
		aRow.createCell(3).setCellValue(rating.getRating_two_total_count());
		aRow.createCell(4).setCellValue(rating.getRating_three_total_count());
                       aRow.createCell(5).setCellValue(rating.getRating_four_total_count());
                       aRow.createCell(6).setCellValue(rating.getRating_five_total_count());
	}
}
 
开发者ID:mustafamym,项目名称:FeedbackCollectionAndMgmtSystem,代码行数:61,代码来源:ExcelBuilder.java

示例7: createSheet

import org.apache.poi.ss.usermodel.CellStyle; //导入方法依赖的package包/类
/**
 * Creates an excel sheet in the provided workbook using provided parameters.
 * 
 * @param input the data to put in the sheet-
 * @param sheetName the name to user for the sheet.
 * @param wb the workbook to create the sheet in.
 */
private void createSheet(	List<MessageResourceEntry> input,
							String sheetName,
							Workbook wb)
{
	// create a new sheet
	String name = StringUtils.isBlank(sheetName) ? this.defaultSheetName : sheetName;
	LOG.info("Create sheet with name " + name);
	Sheet sheet = wb.createSheet(name);
	sheet.setZoom(this.zoom, 100);

	Map<Locale, Integer> langs = getLanguageInformation(input);
	createHeader(sheet, langs);

	CellStyle keyStyle = sheet.getWorkbook().createCellStyle();
	keyStyle.setAlignment(CellStyle.ALIGN_LEFT);
	keyStyle.setBorderBottom(CellStyle.BORDER_THIN);
	keyStyle.setBorderRight(CellStyle.BORDER_MEDIUM);
	Font f = sheet.getWorkbook().createFont();
	f.setBoldweight(Font.BOLDWEIGHT_NORMAL);
	keyStyle.setFont(f);

	CellStyle valueStyle = sheet.getWorkbook().createCellStyle();
	valueStyle.setAlignment(CellStyle.ALIGN_LEFT);
	valueStyle.setVerticalAlignment(CellStyle.VERTICAL_TOP);
	valueStyle.setBorderBottom(CellStyle.BORDER_THIN);
	valueStyle.setBorderRight(CellStyle.BORDER_THIN);
	valueStyle.setBorderTop(CellStyle.BORDER_THIN);
	valueStyle.setBorderLeft(CellStyle.BORDER_THIN);
	valueStyle.setFont(f);
	valueStyle.setWrapText(true);

	CellStyle emptyStyle = sheet.getWorkbook().createCellStyle();
	emptyStyle.setAlignment(CellStyle.ALIGN_LEFT);
	emptyStyle.setVerticalAlignment(CellStyle.VERTICAL_TOP);
	emptyStyle.setBorderBottom(CellStyle.BORDER_THIN);
	emptyStyle.setBorderRight(CellStyle.BORDER_THIN);
	emptyStyle.setBorderTop(CellStyle.BORDER_THIN);
	emptyStyle.setBorderLeft(CellStyle.BORDER_THIN);
	emptyStyle.setFont(f);
	emptyStyle.setFillForegroundColor(IndexedColors.LAVENDER.getIndex());
	emptyStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
	emptyStyle.setWrapText(true);

	LOG.info("Write data to sheet " + name);
	int rowIndex = this.languageHeaderRow + 1;
	for (MessageResourceEntry entry : input)
	{
		Row row = sheet.createRow(rowIndex);
		createContentRow(entry, row, langs, keyStyle, valueStyle, emptyStyle);
		rowIndex++;
	}
	sizeColumns(sheet, langs);
	sheet.createFreezePane(this.firstLanguageColumn, this.languageHeaderRow + 1, this.firstLanguageColumn, this.languageHeaderRow + 1);
}
 
开发者ID:namics,项目名称:spring-i18n-support,代码行数:62,代码来源:ExcelWriter.java

示例8: defaultTotalsDoubleCellStyle

import org.apache.poi.ss.usermodel.CellStyle; //导入方法依赖的package包/类
/**
 * Returns the default totals row style for Double data. Obtained from:
 * http://svn.apache.org/repos/asf/poi
 * /trunk/src/examples/src/org/apache/poi/ss/examples/TimesheetDemo.java
 *
 * @param wb the wb
 * @return the cell style
 */
protected CellStyle defaultTotalsDoubleCellStyle(final Workbook wb) {
    CellStyle style;
    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.CENTER);
    style.setVerticalAlignment(VerticalAlignment.CENTER);
    style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
    style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    style.setDataFormat(doubleDataFormat);
    return style;
}
 
开发者ID:TFyre,项目名称:vaadin-gridexport,代码行数:19,代码来源:ExcelExport.java

示例9: defaultTotalsIntegerCellStyle

import org.apache.poi.ss.usermodel.CellStyle; //导入方法依赖的package包/类
/**
 * Returns the default totals row style for Integer data. Obtained from:
 * http://svn.apache.org/repos/asf/poi
 * /trunk/src/examples/src/org/apache/poi/ss/examples/TimesheetDemo.java
 *
 * @param wb the wb
 * @return the cell style
 */
protected CellStyle defaultTotalsIntegerCellStyle(final Workbook wb) {
    CellStyle style;
    style = wb.createCellStyle();
    style.setAlignment(HorizontalAlignment.CENTER);
    style.setVerticalAlignment(VerticalAlignment.CENTER);
    style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());
    style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    style.setDataFormat(integerDataFormat);
    return style;
}
 
开发者ID:TFyre,项目名称:vaadin-gridexport,代码行数:19,代码来源:ExcelExport.java

示例10: getValue

import org.apache.poi.ss.usermodel.CellStyle; //导入方法依赖的package包/类
/**
 * 对变量名称反射出来的值进行加工处理
 * 
 * @author      ZhengWei(HY)
 * @createDate  2017-06-29
 * @version     v1.0
 *
 * @param i_RTemplate     模板
 * @param i_TemplateCell  模板单元格对象
 * @param i_DataCell      数据单元格对象
 * @param i_DataWorkbook  数据工作薄对象
 * @param i_RSystemValue  系统变量信息
 * @param i_Datas         本行对应的数据
 * @param i_Value         反射出来的变量名称对应的值
 * @return 
 */
public String getValue(RTemplate i_RTemplate ,Cell i_TemplateCell ,Cell i_DataCell ,RWorkbook i_DataWorkbook ,RSystemValue i_RSystemValue ,Object i_Datas ,Object i_Value)
{
    CellStyle v_NewCellStyle = null;
    
    if ( i_DataCell.getRow().getRowNum() % 2 == 1 )
    {
        v_NewCellStyle = i_DataWorkbook.getCellStyleByCopy("单行" ,i_DataCell ,i_RTemplate);
        v_NewCellStyle.setFillForegroundColor(IndexedColors.ORANGE.index);
    }
    else
    {
        v_NewCellStyle = i_DataWorkbook.getCellStyleByCopy("双行" ,i_DataCell ,i_RTemplate);
        v_NewCellStyle.setFillForegroundColor(IndexedColors.RED.index);
    }
    
    v_NewCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    
    i_DataCell.setCellStyle(v_NewCellStyle);
    
    if ( i_Value == null )
    {
        return "";
    }
    
    return i_Value.toString();
}
 
开发者ID:HY-ZhengWei,项目名称:hy.common.report,代码行数:43,代码来源:ColorListener.java

示例11: getHeaderStyle

import org.apache.poi.ss.usermodel.CellStyle; //导入方法依赖的package包/类
/**
 * header样式
 *
 * @return CellStyle
 */
public CellStyle getHeaderStyle() {

    if (buildInStyleMap.containsKey(HEADER_STYLE_KEY)) {
        return buildInStyleMap.get(HEADER_STYLE_KEY);
    }

    CellStyle headerStyle = workbook.createCellStyle();//头的样式
    // 设置单元格的背景颜色为淡蓝色
    headerStyle.setFillForegroundColor(HSSFColor.PALE_BLUE.index);
    headerStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
    this.setCommonStyle(headerStyle);
    buildInStyleMap.put(HEADER_STYLE_KEY, headerStyle);
    return headerStyle;
}
 
开发者ID:goribun,项目名称:excel-rw-annotation,代码行数:20,代码来源:StyleConfiguration.java

示例12: createHSSFCellStyles

import org.apache.poi.ss.usermodel.CellStyle; //导入方法依赖的package包/类
private Map<String, CellStyle> createHSSFCellStyles(Workbook wb, int[] contextBgColor, int[] contextFontColor, int contextFontSize, int contextFontAlign, int[] headerBgColor,
		int[] headerFontColor, int headerFontSize, int headerAlign) {
	Map<String, CellStyle> styles = new HashMap<String, CellStyle>();

	HSSFWorkbook workbook = (HSSFWorkbook) wb;
	HSSFPalette palette = workbook.getCustomPalette();
	palette.setColorAtIndex((short) 11, (byte) contextBgColor[0], (byte) contextBgColor[1], (byte) contextBgColor[2]);
	palette.setColorAtIndex((short) 12, (byte) contextFontColor[0], (byte) contextFontColor[1], (byte) contextFontColor[2]);
	palette.setColorAtIndex((short) 13, (byte) headerBgColor[0], (byte) headerBgColor[1], (byte) headerBgColor[2]);
	palette.setColorAtIndex((short) 14, (byte) headerFontColor[0], (byte) headerFontColor[1], (byte) headerFontColor[2]);

	HSSFFont headerFont = workbook.createFont();
	headerFont.setCharSet(HSSFFont.DEFAULT_CHARSET);
	headerFont.setFontName("宋体");
	headerFont.setColor((short) 14);
	headerFont.setBold(true);
	headerFont.setFontHeightInPoints((short) headerFontSize);
	CellStyle headerStyle = this.createBorderCellStyle(workbook, true);

	headerStyle.setFont(headerFont);
	headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
	headerStyle.setFillForegroundColor((short) 13);
	this.setCellStyleAligment(headerStyle, headerAlign);
	headerStyle.setVerticalAlignment(VerticalAlignment.CENTER);
	styles.put(GridStyleType.headerStyle.name(), headerStyle);

	HSSFFont dataFont = workbook.createFont();
	dataFont.setColor((short) 12);
	dataFont.setFontHeightInPoints((short) contextFontSize);
	dataFont.setCharSet(HSSFFont.DEFAULT_CHARSET);
	dataFont.setFontName("宋体");

	CellStyle dataAlignLeftStyle = this.createBorderCellStyle(workbook, true);
	dataAlignLeftStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
	dataAlignLeftStyle.setFillForegroundColor((short) 11);
	dataAlignLeftStyle.setFont(dataFont);
	dataAlignLeftStyle.setVerticalAlignment(VerticalAlignment.CENTER);
	dataAlignLeftStyle.setWrapText(true);
	dataAlignLeftStyle.setAlignment(HorizontalAlignment.LEFT);
	styles.put(GridStyleType.dataAlignLeftStyle.name(), dataAlignLeftStyle);

	CellStyle dataAlignCenterStyle = this.createBorderCellStyle(workbook, true);
	dataAlignCenterStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
	dataAlignCenterStyle.setFillForegroundColor((short) 11);
	dataAlignCenterStyle.setFont(dataFont);
	dataAlignCenterStyle.setVerticalAlignment(VerticalAlignment.CENTER);
	dataAlignCenterStyle.setWrapText(true);
	dataAlignCenterStyle.setAlignment(HorizontalAlignment.CENTER);
	styles.put(GridStyleType.dataAlignCenterStyle.name(), dataAlignCenterStyle);

	CellStyle dataAlignRightStyle = this.createBorderCellStyle(workbook, true);
	dataAlignRightStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
	dataAlignRightStyle.setFillForegroundColor((short) 11);
	dataAlignRightStyle.setFont(dataFont);
	dataAlignRightStyle.setVerticalAlignment(VerticalAlignment.CENTER);
	dataAlignRightStyle.setWrapText(true);
	dataAlignRightStyle.setAlignment(HorizontalAlignment.RIGHT);
	styles.put(GridStyleType.dataAlignRightStyle.name(), dataAlignRightStyle);

	CellStyle dateStyle = this.createBorderCellStyle(workbook, true);
	CreationHelper helper = workbook.getCreationHelper();
	dateStyle.setDataFormat(helper.createDataFormat().getFormat("m/d/yy h:mm"));
	dateStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
	dateStyle.setFillForegroundColor((short) 11);
	dateStyle.setFont(dataFont);
	dateStyle.setVerticalAlignment(VerticalAlignment.CENTER);
	this.setCellStyleAligment(dateStyle, contextFontAlign);
	styles.put(GridStyleType.dateStyle.name(), dateStyle);

	return styles;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:72,代码来源:GridStyleBuilder.java


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