Java Code Examples for org.apache.poi.ss.usermodel.CellStyle#setFillPattern()
The following examples show how to use
org.apache.poi.ss.usermodel.CellStyle#setFillPattern() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExcelExportStylerColorImpl.java From easypoi with Apache License 2.0 | 6 votes |
@Override public CellStyle stringSeptailStyle(Workbook workbook, boolean isWarp) { CellStyle style = workbook.createCellStyle(); style.setBorderLeft((short) 1); // 左边框 style.setBorderRight((short) 1); // 右边框 style.setBorderBottom((short) 1); style.setBorderTop((short) 1); style.setFillForegroundColor((short) 41); // 填充的背景颜色 style.setFillPattern(CellStyle.SOLID_FOREGROUND); // 填充图案 style.setAlignment(CellStyle.ALIGN_CENTER); style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); style.setDataFormat(STRING_FORMAT); if (isWarp) { style.setWrapText(true); } return style; }
Example 2
Source File: XLSXWriter.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
/** * create a library of cell styles */ private static Map<String, CellStyle> createStyles(Workbook wb){ Map<String, CellStyle> styles = new HashMap<>(); CellStyle style; Font headerFont = wb.createFont(); headerFont.setBold(true); style = createBorderedStyle(wb); style.setFillForegroundColor(IndexedColors.LIGHT_CORNFLOWER_BLUE.getIndex()); style.setFillPattern(FillPatternType.SOLID_FOREGROUND); style.setVerticalAlignment(VerticalAlignment.TOP); style.setWrapText(true); style.setFont(headerFont); styles.put("header", style); style = createBorderedStyle(wb); style.setVerticalAlignment(VerticalAlignment.TOP); style.setWrapText(true); styles.put("body", style); return styles; }
Example 3
Source File: ExcelExportStylerColorImpl.java From jeasypoi with Apache License 2.0 | 6 votes |
@Override public CellStyle stringSeptailStyle(Workbook workbook, boolean isWarp) { CellStyle style = workbook.createCellStyle(); style.setBorderLeft((short) 1); // 左边框 style.setBorderRight((short) 1); // 右边框 style.setBorderBottom((short) 1); style.setBorderTop((short) 1); style.setFillForegroundColor((short) 41); // 填充的背景颜色 style.setFillPattern(CellStyle.SOLID_FOREGROUND); // 填充图案 style.setAlignment(CellStyle.ALIGN_CENTER); style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); style.setDataFormat(STRING_FORMAT); if (isWarp) { style.setWrapText(true); } return style; }
Example 4
Source File: AnnoFormulaTest.java From xlsmapper with Apache License 2.0 | 6 votes |
@XlsPostSave public void handlePostSave(final Sheet sheet) { if(!name.equals("平均")) { return; } final Workbook book = sheet.getWorkbook(); for(Point address : positions.values()) { Cell cell = POIUtils.getCell(sheet, address); CellStyle style = book.createCellStyle(); style.cloneStyleFrom(cell.getCellStyle()); // 塗りつぶし style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); style.setFillPattern(FillPatternType.SOLID_FOREGROUND); // 罫線の上部を変更 style.setBorderTop(BorderStyle.DOUBLE); cell.setCellStyle(style); } }
Example 5
Source File: ExcelExportStylerColorImpl.java From autopoi with Apache License 2.0 | 6 votes |
@Override public CellStyle stringSeptailStyle(Workbook workbook, boolean isWarp) { CellStyle style = workbook.createCellStyle(); style.setBorderLeft((short) 1); // 左边框 style.setBorderRight((short) 1); // 右边框 style.setBorderBottom((short) 1); style.setBorderTop((short) 1); style.setFillForegroundColor((short) 41); // 填充的背景颜色 style.setFillPattern(CellStyle.SOLID_FOREGROUND); // 填充图案 style.setAlignment(CellStyle.ALIGN_CENTER); style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); style.setDataFormat(STRING_FORMAT); if (isWarp) { style.setWrapText(true); } return style; }
Example 6
Source File: Ssio.java From sep4j with Apache License 2.0 | 6 votes |
private static Row createHeaders(Map<String, String> headerMap, Sheet sheet) { CellStyle style = sheet.getWorkbook().createCellStyle(); style.setFillForegroundColor(IndexedColors.YELLOW.getIndex()); style.setFillPattern(CellStyle.SOLID_FOREGROUND); style.setBorderBottom(HSSFCellStyle.BORDER_THIN); style.setBorderTop(HSSFCellStyle.BORDER_THIN); style.setBorderRight(HSSFCellStyle.BORDER_THIN); style.setBorderLeft(HSSFCellStyle.BORDER_THIN); Row header = sheet.createRow(0); int columnIndex = 0; for (Map.Entry<String, String> entry : headerMap.entrySet()) { String headerText = StringUtils.defaultString(entry.getValue()); Cell cell = createCell(header, columnIndex); cell.setCellValue(headerText); cell.setCellStyle(style); sheet.autoSizeColumn(columnIndex); columnIndex++; } return header; }
Example 7
Source File: ColorUtils.java From Octopus with MIT License | 5 votes |
public static void setForegroundColor(Workbook workbook, CellStyle cellStyle, Color color) { if (color == null) { return; } cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); if (cellStyle instanceof XSSFCellStyle) { ((XSSFCellStyle) cellStyle).setFillForegroundColor(new XSSFColor(color)); } else if (cellStyle instanceof HSSFCellStyle && workbook instanceof HSSFWorkbook) { cellStyle.setFillForegroundColor(getSimilarColor((HSSFWorkbook) workbook, color).getIndex()); } else { log.error("unknown font type"); } }
Example 8
Source File: ExcelUtil.java From supplierShop with MIT License | 5 votes |
/** * 创建表格样式 * * @param wb 工作薄对象 * @return 样式列表 */ private Map<String, CellStyle> createStyles(Workbook wb) { // 写入各条记录,每条记录对应excel表中的一行 Map<String, CellStyle> styles = new HashMap<String, CellStyle>(); CellStyle style = wb.createCellStyle(); style.setAlignment(HorizontalAlignment.CENTER); style.setVerticalAlignment(VerticalAlignment.CENTER); style.setBorderRight(BorderStyle.THIN); style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); style.setBorderLeft(BorderStyle.THIN); style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); style.setBorderTop(BorderStyle.THIN); style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); style.setBorderBottom(BorderStyle.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.CENTER); style.setVerticalAlignment(VerticalAlignment.CENTER); style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex()); style.setFillPattern(FillPatternType.SOLID_FOREGROUND); Font headerFont = wb.createFont(); headerFont.setFontName("Arial"); headerFont.setFontHeightInPoints((short) 10); headerFont.setBold(true); headerFont.setColor(IndexedColors.WHITE.getIndex()); style.setFont(headerFont); styles.put("header", style); return styles; }
Example 9
Source File: ColorListener.java From hy.common.report with Apache License 2.0 | 5 votes |
/** * 对变量名称反射出来的值进行加工处理 * * @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(this.oddNumberolor); } else { v_NewCellStyle = i_DataWorkbook.getCellStyleByCopy("偶数行" ,i_DataCell ,i_RTemplate); v_NewCellStyle.setFillForegroundColor(this.evenNumberColor); } v_NewCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); Row v_Row = i_DataCell.getRow(); int v_CellCount = v_Row.getLastCellNum(); for (int i=0; i<v_CellCount; i++) { v_Row.getCell(i).setCellStyle(v_NewCellStyle); } if ( i_Value == null ) { return ""; } return i_Value.toString(); }
Example 10
Source File: ExcelUtil.java From danyuan-application with Apache License 2.0 | 5 votes |
/** * 复制一个单元格样式到目的单元格样式 * * @param fromStyle * @param toStyle */ public static void copyCellStyle(CellStyle fromStyle, CellStyle toStyle) { toStyle.setAlignment(fromStyle.getAlignmentEnum()); // 边框和边框颜色 toStyle.setBorderBottom(fromStyle.getBorderBottomEnum()); toStyle.setBorderLeft(fromStyle.getBorderLeftEnum()); toStyle.setBorderRight(fromStyle.getBorderRightEnum()); toStyle.setBorderTop(fromStyle.getBorderTopEnum()); toStyle.setTopBorderColor(fromStyle.getTopBorderColor()); toStyle.setBottomBorderColor(fromStyle.getBottomBorderColor()); toStyle.setRightBorderColor(fromStyle.getRightBorderColor()); toStyle.setLeftBorderColor(fromStyle.getLeftBorderColor()); // 背景和前景 toStyle.setFillBackgroundColor(fromStyle.getFillBackgroundColor()); toStyle.setFillForegroundColor(fromStyle.getFillForegroundColor()); // 数据格式 toStyle.setDataFormat(fromStyle.getDataFormat()); toStyle.setFillPattern(fromStyle.getFillPatternEnum()); // toStyle.setFont(fromStyle.getFont(null)); toStyle.setHidden(fromStyle.getHidden()); toStyle.setIndention(fromStyle.getIndention());// 首行缩进 toStyle.setLocked(fromStyle.getLocked()); toStyle.setRotation(fromStyle.getRotation());// 旋转 toStyle.setVerticalAlignment(fromStyle.getVerticalAlignmentEnum()); toStyle.setWrapText(fromStyle.getWrapText()); }
Example 11
Source File: AbstractSheet.java From tools with Apache License 2.0 | 5 votes |
public static CellStyle createHeaderStyle(Workbook wb) { CellStyle headerStyle = wb.createCellStyle(); headerStyle.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index); headerStyle.setFillPattern(CellStyle.SOLID_FOREGROUND); Font headerFont = wb.createFont(); headerFont.setFontName("Arial"); headerFont.setFontHeight(FONT_SIZE); headerFont.setBoldweight(Font.BOLDWEIGHT_BOLD); headerStyle.setFont(headerFont); headerStyle.setAlignment(CellStyle.ALIGN_CENTER); return headerStyle; }
Example 12
Source File: ExportTimetableXLS.java From unitime with Apache License 2.0 | 5 votes |
protected CellStyle getMeetingHeaderStyle(P p, P parent, Color bgColor) { if (bgColor == null) bgColor = Color.WHITE; String styleId = "meeting-header-" + Integer.toHexString(bgColor.getRGB()) + (p.iItalics ? "-italics" : ""); CellStyle style = iStyles.get(styleId); if (style == null) { style = iWorkbook.createCellStyle(); style.setBorderTop(BorderStyle.THICK); style.setTopBorderColor(IndexedColors.BLACK.getIndex()); style.setBorderLeft(BorderStyle.THICK); style.setLeftBorderColor(IndexedColors.BLACK.getIndex()); style.setBorderRight(BorderStyle.THICK); style.setRightBorderColor(IndexedColors.BLACK.getIndex()); style.setAlignment(HorizontalAlignment.CENTER); style.setVerticalAlignment(VerticalAlignment.TOP); style.setFont(getFont(parent)); String colorId = Integer.toHexString(bgColor.getRGB()); Short color = iColors.get(colorId); if (color == null) { HSSFPalette palette = ((HSSFWorkbook)iWorkbook).getCustomPalette(); HSSFColor clr = palette.findSimilarColor(bgColor.getRed(), bgColor.getGreen(), bgColor.getBlue()); color = (clr == null ? IndexedColors.BLACK.getIndex() : clr.getIndex()); iColors.put(colorId, color); } style.setFillForegroundColor(color); style.setFillPattern(FillPatternType.SOLID_FOREGROUND); style.setWrapText(true); iStyles.put(styleId, style); } return style; }
Example 13
Source File: ReportStudentsUTLCandidates.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 5 votes |
private CellStyle headerBackgroundStyle(final HSSFWorkbook wb) { CellStyle style = wb.createCellStyle(); style.setFillBackgroundColor(IndexedColors.AQUA.getIndex()); style.setFillPattern(FillPatternType.BIG_SPOTS); return style; }
Example 14
Source File: UKExcelUtil.java From youkefu with Apache License 2.0 | 5 votes |
/** * 首列样式 * @return */ @SuppressWarnings("deprecation") private CellStyle createFirstCellStyle(){ CellStyle cellStyle = baseCellStyle(); Font font = wb.createFont(); font.setFontHeight((short) 180); cellStyle.setFont(font); cellStyle.setFillForegroundColor(HSSFColor.LIGHT_GREEN.index); cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); return cellStyle; }
Example 15
Source File: HRExcelBuilder.java From Spring-MVC-Blueprints with MIT License | 4 votes |
@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 @SuppressWarnings("unchecked") List<HrmsLogin> users = (List<HrmsLogin>) model.get("allUsers"); // create a new Excel sheet HSSFSheet sheet = workbook.createSheet("User List"); 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("Employee ID"); header.getCell(0).setCellStyle(style); header.createCell(1).setCellValue("Username"); header.getCell(1).setCellStyle(style); header.createCell(2).setCellValue("Password"); header.getCell(2).setCellStyle(style); header.createCell(3).setCellValue("Role"); header.getCell(3).setCellStyle(style); // create data rows int rowCount = 1; for (HrmsLogin account : users) { HSSFRow aRow = sheet.createRow(rowCount++); aRow.createCell(0).setCellValue(account.getHrmsEmployeeDetails().getEmpId()); aRow.createCell(1).setCellValue(account.getUsername()); aRow.createCell(2).setCellValue(account.getPassword()); aRow.createCell(3).setCellValue(account.getRole()); } }
Example 16
Source File: FillPattern.java From excel-io with MIT License | 4 votes |
@Override public void accept(final CellStyle style) { style.setFillPattern(this.pattern); }
Example 17
Source File: ExcelView.java From Spring-MVC-Blueprints with MIT License | 4 votes |
@Override protected void buildExcelDocument(Map<String, Object> model, Workbook workbook, HttpServletRequest request, HttpServletResponse response) throws Exception { Sheet sheet = workbook.createSheet("sheet 1"); List<HrmsLogin> users = (List<HrmsLogin>) model.get("allUsers"); Row row = null; Cell cell = null; int r = 0; int c = 0; //Style for header cell CellStyle style = workbook.createCellStyle(); style.setFillForegroundColor(IndexedColors.GREY_40_PERCENT.index); style.setFillPattern(CellStyle.SOLID_FOREGROUND); style.setAlignment(CellStyle.ALIGN_CENTER); //Create header cells row = sheet.createRow(r++); cell = row.createCell(c++); cell.setCellStyle(style); cell.setCellValue("Employee ID"); cell = row.createCell(c++); cell.setCellStyle(style); cell.setCellValue("Username"); cell = row.createCell(c++); cell.setCellStyle(style); cell.setCellValue("Password"); cell = row.createCell(c++); cell.setCellStyle(style); cell.setCellValue("Role"); //Create data cell for(HrmsLogin user: users){ row = sheet.createRow(r++); c = 0; row.createCell(c++).setCellValue(user.getHrmsEmployeeDetails().getEmpId()); row.createCell(c++).setCellValue(user.getUsername()); row.createCell(c++).setCellValue(user.getPassword()); row.createCell(c++).setCellValue(user.getRole()); } for(int i = 0 ; i < 4; i++) sheet.autoSizeColumn(i, true); }
Example 18
Source File: ExcelWriter_StyleFormatTest.java From hop with Apache License 2.0 | 4 votes |
/** * Setup the data necessary for Excel Writer transform * * @param fileType * @throws HopException */ private void createTransformData( String fileType ) throws HopException { transformData = new ExcelWriterData(); transformData.inputRowMeta = transform.getInputRowMeta().clone(); transformData.outputRowMeta = transform.getInputRowMeta().clone(); // we don't run pipeline so ExcelWriter.processRow() doesn't get executed // we populate the ExcelWriterData with bare minimum required values // CellReference cellRef = new CellReference( transformMeta.getStartingCell() ); transformData.startingRow = cellRef.getRow(); transformData.startingCol = cellRef.getCol(); transformData.posX = transformData.startingCol; transformData.posY = transformData.startingRow; int numOfFields = transformData.inputRowMeta.size(); transformData.fieldnrs = new int[ numOfFields ]; transformData.linkfieldnrs = new int[ numOfFields ]; transformData.commentfieldnrs = new int[ numOfFields ]; for ( int i = 0; i < numOfFields; i++ ) { transformData.fieldnrs[ i ] = i; transformData.linkfieldnrs[ i ] = -1; transformData.commentfieldnrs[ i ] = -1; } // we avoid reading/writing Excel files, so ExcelWriter.prepareNextOutputFile() doesn't get executed // create Excel workbook object // transformData.wb = transformMeta.getExtension().equalsIgnoreCase( "xlsx" ) ? new XSSFWorkbook() : new HSSFWorkbook(); transformData.sheet = transformData.wb.createSheet(); transformData.file = null; transformData.clearStyleCache( numOfFields ); // we avoid reading template file from disk // so set beforehand cells with custom style and formatting DataFormat format = transformData.wb.createDataFormat(); Row xlsRow = transformData.sheet.createRow( 0 ); // Cell F1 has custom style applied, used as template Cell cell = xlsRow.createCell( 5 ); CellStyle cellStyle = transformData.wb.createCellStyle(); cellStyle.setBorderRight( BorderStyle.THICK ); cellStyle.setFillPattern( FillPatternType.FINE_DOTS ); cell.setCellStyle( cellStyle ); // Cell G1 has same style, but also a custom data format cellStyle = transformData.wb.createCellStyle(); cellStyle.cloneStyleFrom( cell.getCellStyle() ); cell = xlsRow.createCell( 6 ); cellStyle.setDataFormat( format.getFormat( "##0,000.0" ) ); cell.setCellStyle( cellStyle ); }
Example 19
Source File: ExcelExport.java From frpMgr with MIT License | 4 votes |
/** * 创建表格样式 * @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; }
Example 20
Source File: CrosstabXLSExporter.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
public CellStyle buildHeaderCellStyle(Sheet sheet) { CellStyle cellStyle = sheet.getWorkbook().createCellStyle(); cellStyle.setAlignment(CellStyle.ALIGN_LEFT); cellStyle.setVerticalAlignment(CellStyle.ALIGN_CENTER); String headerBGColor = (String) this.getProperty(PROPERTY_HEADER_BACKGROUND_COLOR); logger.debug("Header background color : " + headerBGColor); short backgroundColorIndex = headerBGColor != null ? IndexedColors.valueOf(headerBGColor).getIndex() : IndexedColors.valueOf( DEFAULT_HEADER_BACKGROUND_COLOR).getIndex(); cellStyle.setFillForegroundColor(backgroundColorIndex); cellStyle.setFillPattern(CellStyle.SOLID_FOREGROUND); cellStyle.setBorderBottom(CellStyle.BORDER_THIN); cellStyle.setBorderLeft(CellStyle.BORDER_THIN); cellStyle.setBorderRight(CellStyle.BORDER_THIN); cellStyle.setBorderTop(CellStyle.BORDER_THIN); String bordeBorderColor = (String) this.getProperty(PROPERTY_HEADER_BORDER_COLOR); logger.debug("Header border color : " + bordeBorderColor); short borderColorIndex = bordeBorderColor != null ? IndexedColors.valueOf(bordeBorderColor).getIndex() : IndexedColors.valueOf( DEFAULT_HEADER_BORDER_COLOR).getIndex(); cellStyle.setLeftBorderColor(borderColorIndex); cellStyle.setRightBorderColor(borderColorIndex); cellStyle.setBottomBorderColor(borderColorIndex); cellStyle.setTopBorderColor(borderColorIndex); Font font = sheet.getWorkbook().createFont(); Short headerFontSize = (Short) this.getProperty(PROPERTY_HEADER_FONT_SIZE); logger.debug("Header font size : " + headerFontSize); short headerFontSizeShort = headerFontSize != null ? headerFontSize.shortValue() : DEFAULT_HEADER_FONT_SIZE; font.setFontHeightInPoints(headerFontSizeShort); String fontName = (String) this.getProperty(PROPERTY_FONT_NAME); logger.debug("Font name : " + fontName); fontName = fontName != null ? fontName : DEFAULT_FONT_NAME; font.setFontName(fontName); String headerColor = (String) this.getProperty(PROPERTY_HEADER_COLOR); logger.debug("Header color : " + headerColor); short headerColorIndex = bordeBorderColor != null ? IndexedColors.valueOf(headerColor).getIndex() : IndexedColors.valueOf(DEFAULT_HEADER_COLOR) .getIndex(); font.setColor(headerColorIndex); font.setBoldweight(Font.BOLDWEIGHT_BOLD); cellStyle.setFont(font); return cellStyle; }