List of usage examples for org.apache.poi.ss.usermodel FillPatternType SOLID_FOREGROUND
FillPatternType SOLID_FOREGROUND
To view the source code for org.apache.poi.ss.usermodel FillPatternType SOLID_FOREGROUND.
Click Source Link
From source file:br.com.tecsinapse.dataio.style.TableCellStyle.java
License:LGPL
public CellStyle toCellStyle(Workbook wb) { CellStyle cellStyle = wb.createCellStyle(); final HSSFColor bgColor = getBackgroundColor(); if (bgColor != null) { if (cellStyle instanceof XSSFCellStyle) { ((XSSFCellStyle) cellStyle)// w w w. j a v a2s . co m .setFillForegroundColor(new XSSFColor(toAwtColor(bgColor), new DefaultIndexedColorMap())); } else { cellStyle.setFillForegroundColor(getBackgroundColor().getIndex()); } cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); } if (getBorder() != null) { cellStyle = border.toCellStyle(cellStyle); } if (getVAlign() != null) { cellStyle.setVerticalAlignment(vAlign.getCellStyleVAlign()); } if (getHAlign() != null) { cellStyle.setAlignment(hAlign.getCellStyleHAlign()); } cellStyle.setWrapText(isWrapText()); Font font = wb.createFont(); configFont(font); cellStyle.setFont(font); if (cellFormat != null && !cellFormat.isEmpty()) { cellStyle.setDataFormat(wb.createDataFormat().getFormat(cellFormat)); } return cellStyle; }
From source file:ch.admin.isb.hermes5.business.userszenario.projektstrukturplan.ProjektstrukturplanGeneratorExcel.java
License:Apache License
private XSSFCellStyle getHeaderStyle(XSSFWorkbook wb) { XSSFCellStyle cellStyle = wb.createCellStyle(); cellStyle.setFillForegroundColor(new XSSFColor(new Color(184, 204, 228))); cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); XSSFFont headerFont = wb.createFont(); headerFont.setFontHeight(12);/*from w w w . java 2 s. co m*/ headerFont.setFontName(fontName.getStringValue()); cellStyle.setFont(headerFont); return cellStyle; }
From source file:cn.afterturn.easypoi.excel.export.styler.ExcelExportStylerColorImpl.java
License:Apache License
@Override public CellStyle getTitleStyle(short color) { CellStyle titleStyle = workbook.createCellStyle(); titleStyle.setFillForegroundColor(color); titleStyle.setAlignment(HorizontalAlignment.CENTER); titleStyle.setVerticalAlignment(VerticalAlignment.CENTER); titleStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); titleStyle.setWrapText(true);/*from w ww .j a v a 2 s . c o m*/ return titleStyle; }
From source file:cn.afterturn.easypoi.excel.export.styler.ExcelExportStylerColorImpl.java
License:Apache License
@Override public CellStyle stringSeptailStyle(Workbook workbook, boolean isWarp) { CellStyle style = workbook.createCellStyle(); style.setBorderLeft(BorderStyle.THIN); style.setBorderRight(BorderStyle.THIN); style.setBorderBottom(BorderStyle.THIN); style.setBorderTop(BorderStyle.THIN); style.setFillForegroundColor((short) 41); style.setFillPattern(FillPatternType.SOLID_FOREGROUND); style.setAlignment(HorizontalAlignment.CENTER); style.setVerticalAlignment(VerticalAlignment.CENTER); style.setDataFormat(STRING_FORMAT);/* ww w .java 2 s .c om*/ if (isWarp) { style.setWrapText(true); } return style; }
From source file:cn.com.zhbook.component.poi.PoiPerformanceTest.java
License:Apache License
static Map<String, CellStyle> createStyles(Workbook wb) { Map<String, CellStyle> styles = new HashMap<String, CellStyle>(); CellStyle style;//w ww. j a va2 s. co m Font headerFont = wb.createFont(); headerFont.setFontHeightInPoints((short) 14); headerFont.setBold(true); style = wb.createCellStyle(); style.setAlignment(HorizontalAlignment.CENTER); style.setVerticalAlignment(VerticalAlignment.CENTER); style.setFont(headerFont); style.setFillForegroundColor(IndexedColors.LIGHT_CORNFLOWER_BLUE.getIndex()); style.setFillPattern(FillPatternType.SOLID_FOREGROUND); styles.put("header", style); Font monthFont = wb.createFont(); monthFont.setFontHeightInPoints((short) 12); monthFont.setColor(IndexedColors.RED.getIndex()); monthFont.setBold(true); style = wb.createCellStyle(); style.setAlignment(HorizontalAlignment.CENTER); style.setVerticalAlignment(VerticalAlignment.CENTER); style.setFillForegroundColor(IndexedColors.YELLOW.getIndex()); style.setFillPattern(FillPatternType.SOLID_FOREGROUND); style.setFont(monthFont); styles.put("red-bold", style); String[] nfmt = { "#,##0.00", "$#,##0.00", "m/d/yyyy" }; for (String fmt : nfmt) { style = wb.createCellStyle(); style.setDataFormat(wb.createDataFormat().getFormat(fmt)); styles.put(fmt, style); } return styles; }
From source file:com.adobe.acs.commons.mcp.impl.ProcessErrorReportExcelServlet.java
License:Apache License
CellStyle createHeaderStyle(Workbook wb) {
XSSFCellStyle xstyle = (XSSFCellStyle) wb.createCellStyle();
XSSFColor header = new XSSFColor(new Color(79, 129, 189));
xstyle.setFillForegroundColor(header);
xstyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
XSSFFont font = (XSSFFont) wb.createFont();
font.setColor(IndexedColors.WHITE.index);
xstyle.setFont(font);/*from w ww . ja v a 2 s . c o m*/
return xstyle;
}
From source file:com.axelor.apps.admin.service.ViewDocExportService.java
License:Open Source License
private void addStyle() { style = workBook.createCellStyle();/*from w w w. jav a 2s. com*/ style.setBorderBottom(CellStyle.BORDER_THIN); style.setBorderTop(CellStyle.BORDER_THIN); style.setBorderLeft(CellStyle.BORDER_THIN); style.setBorderRight(CellStyle.BORDER_THIN); green = workBook.createCellStyle(); green.cloneStyleFrom(style); green.setFillForegroundColor(IndexedColors.BRIGHT_GREEN.index); green.setFillPattern(FillPatternType.SOLID_FOREGROUND); lavender = workBook.createCellStyle(); lavender.cloneStyleFrom(green); lavender.setFillForegroundColor(IndexedColors.LAVENDER.index); violet = workBook.createCellStyle(); violet.cloneStyleFrom(green); violet.setFillForegroundColor(IndexedColors.VIOLET.index); }
From source file:com.ferid.app.classroom.utility.ExcelStyleManager.java
License:Apache License
/** * Header cell style (dates)//from w ww . j a v a 2s. c om * @param wb Workbook * @return CellStyle */ public static CellStyle getHeaderCellStyle(Workbook wb) { CellStyle cellStyle = wb.createCellStyle(); cellStyle.setAlignment(HorizontalAlignment.CENTER); Font font = wb.createFont(); font.setFontHeightInPoints((short) 8); font.setBold(true); cellStyle.setFont(font); cellStyle.setWrapText(true); cellStyle.setFillForegroundColor(IndexedColors.LIGHT_TURQUOISE.getIndex()); cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); cellStyle.setBorderRight(BorderStyle.THIN); cellStyle.setRightBorderColor(IndexedColors.BLACK.getIndex()); cellStyle.setBorderBottom(BorderStyle.THIN); cellStyle.setBottomBorderColor(IndexedColors.BLACK.getIndex()); cellStyle.setBorderLeft(BorderStyle.THIN); cellStyle.setLeftBorderColor(IndexedColors.BLACK.getIndex()); cellStyle.setBorderTop(BorderStyle.THIN); cellStyle.setTopBorderColor(IndexedColors.BLACK.getIndex()); return cellStyle; }
From source file:com.ferid.app.classroom.utility.ExcelStyleManager.java
License:Apache License
/** * Content cell style (presence)//from w ww .ja v a 2 s. com * @param wb Workbook * @return CellStyle */ public static CellStyle getContentCellStyle(Workbook wb) { CellStyle cellStyle = wb.createCellStyle(); cellStyle.setAlignment(HorizontalAlignment.CENTER); Font font = wb.createFont(); font.setFontHeightInPoints((short) 8); cellStyle.setFont(font); cellStyle.setWrapText(true); cellStyle.setFillForegroundColor(IndexedColors.LIGHT_YELLOW.getIndex()); cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); cellStyle.setBorderRight(BorderStyle.THIN); cellStyle.setRightBorderColor(IndexedColors.BLACK.getIndex()); cellStyle.setBorderBottom(BorderStyle.THIN); cellStyle.setBottomBorderColor(IndexedColors.BLACK.getIndex()); cellStyle.setBorderLeft(BorderStyle.THIN); cellStyle.setLeftBorderColor(IndexedColors.BLACK.getIndex()); cellStyle.setBorderTop(BorderStyle.THIN); cellStyle.setTopBorderColor(IndexedColors.BLACK.getIndex()); return cellStyle; }
From source file:com.funtl.framework.smoke.core.commons.excel.ExportExcel.java
License:Apache License
/** * ?//from www . j av a 2 s . co m * * @param wb * @return ? */ private Map<String, CellStyle> createStyles(Workbook wb) { Map<String, CellStyle> styles = new HashMap<String, CellStyle>(); CellStyle style = wb.createCellStyle(); style.setAlignment(HorizontalAlignment.CENTER); // style.setAlignment(CellStyle.ALIGN_CENTER); style.setVerticalAlignment(VerticalAlignment.CENTER); // style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); Font titleFont = wb.createFont(); titleFont.setFontName("Arial"); titleFont.setFontHeightInPoints((short) 16); titleFont.setBold(true); // titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD); style.setFont(titleFont); styles.put("title", style); style = wb.createCellStyle(); style.setVerticalAlignment(VerticalAlignment.CENTER); // style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); style.setBorderRight(BorderStyle.THIN); // style.setBorderRight(CellStyle.BORDER_THIN); style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); style.setBorderLeft(BorderStyle.THIN); // style.setBorderLeft(CellStyle.BORDER_THIN); style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); style.setBorderTop(BorderStyle.THIN); // style.setBorderTop(CellStyle.BORDER_THIN); style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); style.setBorderBottom(BorderStyle.THIN); // 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(HorizontalAlignment.LEFT); // style.setAlignment(CellStyle.ALIGN_LEFT); styles.put("data1", style); style = wb.createCellStyle(); style.cloneStyleFrom(styles.get("data")); style.setAlignment(HorizontalAlignment.CENTER); // style.setAlignment(CellStyle.ALIGN_CENTER); styles.put("data2", style); style = wb.createCellStyle(); style.cloneStyleFrom(styles.get("data")); style.setAlignment(HorizontalAlignment.RIGHT); // style.setAlignment(CellStyle.ALIGN_RIGHT); styles.put("data3", style); style = wb.createCellStyle(); style.cloneStyleFrom(styles.get("data")); // style.setWrapText(true); style.setAlignment(HorizontalAlignment.CENTER); // style.setAlignment(CellStyle.ALIGN_CENTER); style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex()); style.setFillPattern(FillPatternType.SOLID_FOREGROUND); // style.setFillPattern(CellStyle.SOLID_FOREGROUND); Font headerFont = wb.createFont(); headerFont.setFontName("Arial"); headerFont.setFontHeightInPoints((short) 10); headerFont.setBold(true); // headerFont.setBoldweight(Font.BOLDWEIGHT_BOLD); headerFont.setColor(IndexedColors.WHITE.getIndex()); style.setFont(headerFont); styles.put("header", style); return styles; }