List of usage examples for org.apache.poi.ss.usermodel CellStyle setBorderTop
void setBorderTop(BorderStyle border);
From source file:org.displaytag.render.HssfTableWriter.java
License:Open Source License
@Override protected void writeTableBodyCloser(TableModel model) throws Exception { // write totals, if there are any boolean hasTotals = false; for (HeaderCell cell : model.getHeaderCellList()) { hasTotals = hasTotals || cell.isTotaled(); }//from w w w.jav a 2 s.c o m if (!hasTotals) { return; } TableTotaler tt = model.getTotaler(); writeRowOpener(null); for (HeaderCell cell : model.getHeaderCellList()) { writeColumnOpener(null); Object columnValue = (cell.isTotaled()) ? tt.getTotalForColumn(cell.getColumnNumber(), 0) : null; writeCellValue(columnValue); CellStyle st = this.utils.getNewCellStyle(); st.cloneStyleFrom(this.currentCell.getCellStyle()); st.setBorderTop(CellStyle.BORDER_THIN); st.setTopBorderColor(IndexedColors.BLACK.getIndex()); this.currentCell.setCellStyle(st); writeColumnCloser(null); } writeRowCloser(null); }
From source file:org.eclipse.sw360.exporter.ExcelExporter.java
License:Open Source License
/** * Create style for data cells/* w w w .ja va 2s . co m*/ */ private static CellStyle createCellStyle(Workbook workbook) { CellStyle cellStyle = workbook.createCellStyle(); cellStyle.setBorderBottom(XSSFCellStyle.BORDER_THIN); cellStyle.setBorderTop(XSSFCellStyle.BORDER_THIN); cellStyle.setBorderRight(XSSFCellStyle.BORDER_THIN); cellStyle.setBorderLeft(XSSFCellStyle.BORDER_THIN); return cellStyle; }
From source file:org.hellojavaer.poi.excel.utils.ExcelUtils.java
License:Apache License
@SuppressWarnings("rawtypes") private static void writeHead(boolean useTemplate, Sheet sheet, ExcelWriteSheetProcessor sheetProcessor) { Integer headRowIndex = sheetProcessor.getHeadRowIndex(); if (headRowIndex == null) { return;// w ww . j av a 2s . c om } Workbook wookbook = sheet.getWorkbook(); // use theme CellStyle style = null; if (!useTemplate && sheetProcessor.getTheme() != null) { int theme = sheetProcessor.getTheme(); if (theme == ExcelWriteTheme.BASE) { style = wookbook.createCellStyle(); style.setFillPattern(CellStyle.SOLID_FOREGROUND); style.setFillForegroundColor((short) 44); style.setBorderBottom(CellStyle.BORDER_THIN); style.setBorderLeft(CellStyle.BORDER_THIN); style.setBorderRight(CellStyle.BORDER_THIN); style.setBorderTop(CellStyle.BORDER_THIN); // style.setBottomBorderColor((short) 44); style.setAlignment(CellStyle.ALIGN_CENTER); } // freeze Pane if (sheetProcessor.getHeadRowIndex() != null && sheetProcessor.getHeadRowIndex() == 0) { sheet.createFreezePane(0, 1, 0, 1); } } Row row = sheet.getRow(headRowIndex); if (row == null) { row = sheet.createRow(headRowIndex); } for (Map.Entry<String, Map<Integer, ExcelWriteFieldMappingAttribute>> entry : sheetProcessor .getFieldMapping().export().entrySet()) { Map<Integer, ExcelWriteFieldMappingAttribute> map = entry.getValue(); if (map != null) { for (Map.Entry<Integer, ExcelWriteFieldMappingAttribute> entry2 : map.entrySet()) { String head = entry2.getValue().getHead(); Integer colIndex = entry2.getKey(); Cell cell = row.getCell(colIndex); if (cell == null) { cell = row.createCell(colIndex); } // use theme if (!useTemplate && sheetProcessor.getTheme() != null) { cell.setCellStyle(style); } cell.setCellValue(head); } } } }
From source file:org.jaffa.qm.finder.apis.ExcelExportService.java
License:Open Source License
public static Workbook generateExcel(QueryServiceConfig master, QueryServiceConfig child, String sheetName) throws ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { Workbook wb = null;//from w w w .jav a 2s. c om String legacyExport = (String) ContextManagerFactory.instance() .getProperty("jaffa.widgets.exportToExcel.legacy"); if (legacyExport != null && legacyExport.equals("T")) { wb = new HSSFWorkbook(); } else { wb = new SXSSFWorkbook(100); } try { // Creating worksheet Sheet sheet = null; if (sheetName != null) sheet = wb.createSheet(sheetName); else sheet = wb.createSheet(); // creating a custom palette for the workbook CellStyle style = wb.createCellStyle(); style = wb.createCellStyle(); // setting the foreground color to gray style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); style.setFillPattern(CellStyle.SOLID_FOREGROUND); // Setting the border for the cells style.setBorderBottom(CellStyle.BORDER_THIN); style.setBottomBorderColor(IndexedColors.BLACK.getIndex()); style.setBorderLeft(CellStyle.BORDER_THIN); style.setLeftBorderColor(IndexedColors.GREEN.getIndex()); style.setBorderRight(CellStyle.BORDER_THIN); style.setRightBorderColor(IndexedColors.BLACK.getIndex()); style.setBorderTop(CellStyle.BORDER_THIN); style.setTopBorderColor(IndexedColors.BLACK.getIndex()); style.setAlignment(CellStyle.ALIGN_CENTER); // setting font weight Font titleFont = wb.createFont(); titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD); style.setFont(titleFont); int rowNum = 0; Row headerRow = sheet.createRow(rowNum); int colIndex = 0; for (Object o : master.getColumnModel()) { String columnTitle = (String) ((DynaBean) o).get("header"); if (columnTitle == null || columnTitle.length() == 0) columnTitle = (String) ((DynaBean) o).get("mapping"); headerRow.createCell(colIndex).setCellValue(columnTitle); Cell cell = headerRow.getCell(colIndex); cell.setCellStyle(style); sheet.autoSizeColumn(colIndex); colIndex += 1; } // Generate the Excel output by creating a simple HTML table if (child != null) { for (Object o : child.getColumnModel()) { String columnTitle = (String) ((DynaBean) o).get("header"); if (columnTitle == null || columnTitle.length() == 0) columnTitle = (String) ((DynaBean) o).get("mapping"); headerRow.createCell(colIndex).setCellValue(columnTitle); Cell cell = headerRow.getCell(colIndex); cell.setCellStyle(style); sheet.autoSizeColumn(colIndex); colIndex += 1; } } // Invoke the query and obtain an array of Graph objects Object[] queryOutput = invokeQueryService(master.getCriteriaClassName(), master.getCriteriaObject(), master.getServiceClassName(), master.getServiceClassMethodName()); // Add the data rows if (queryOutput != null) { for (Object row : queryOutput) { Object[] detailQueryOutput = new Object[0]; if (child == null) { rowNum += 1; Row dataRow = sheet.createRow((short) rowNum); int colNum = 0; // extract the columns from master object for (Object o : master.getColumnModel()) { String mapping = (String) ((DynaBean) o).get("mapping"); Object value = null; if (mapping.startsWith("appFields.")) { mapping = mapping.substring(10); try { Object[] appFields = (Object[]) PropertyUtils.getProperty(row, "applicationFields"); for (Object field : appFields) { String name = (String) PropertyUtils.getProperty(field, "name"); if (name.equals(mapping)) { value = (String) PropertyUtils.getProperty(field, "value"); } } } catch (Exception e) { if (log.isDebugEnabled()) log.debug("Property not found: " + mapping, e); } } else { try { value = PropertyUtils.getProperty(row, mapping); } catch (Exception e) { if (log.isDebugEnabled()) log.debug("Property not found: " + mapping, e); } } dataRow.createCell(colNum).setCellValue(format(value, (DynaBean) o)); colNum += 1; } } else { //child is not null // load the child rows String detailCriteriaObject = child.getCriteriaObject(); for (int i = 0; i < child.getMasterKeyFieldNames().length; i++) { String kfn = child.getMasterKeyFieldNames()[i]; try { String keyValue = (String) PropertyUtils.getProperty(row, kfn); detailCriteriaObject = detailCriteriaObject.replace("{" + i + "}", keyValue); } catch (Exception e) { if (log.isDebugEnabled()) log.debug("Key property not found: " + kfn, e); } } detailQueryOutput = invokeQueryService(child.getCriteriaClassName(), detailCriteriaObject, child.getServiceClassName(), "query"); // add the child columns if (detailQueryOutput != null && detailQueryOutput.length > 0) { for (Object detailRow : detailQueryOutput) { rowNum += 1; Row dataRow = sheet.createRow((short) rowNum); int colNum = 0; // extract the columns from master object for (Object obj : master.getColumnModel()) { String masterMapping = (String) ((DynaBean) obj).get("mapping"); Object masterValue = null; try { masterValue = PropertyUtils.getProperty(row, masterMapping); } catch (Exception e) { if (log.isDebugEnabled()) log.debug("Property not found: " + masterMapping, e); } dataRow.createCell(colNum).setCellValue(format(masterValue, (DynaBean) obj)); colNum += 1; } for (Object o : child.getColumnModel()) { String mapping = (String) ((DynaBean) o).get("mapping"); Object value = null; try { value = PropertyUtils.getProperty(detailRow, mapping); } catch (Exception e) { if (log.isDebugEnabled()) log.debug("Property not found in child result: " + mapping, e); } dataRow.createCell(colNum).setCellValue(format(value, (DynaBean) o)); colNum += 1; } } } } } } } catch (Exception e) { e.printStackTrace(); } return wb; }
From source file:org.jaffa.ria.finder.apis.ExcelExportService.java
License:Open Source License
public static Workbook generateExcel(QueryServiceConfig master, QueryServiceConfig child, String sheetName) throws ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException { Workbook wb = null;/*from www.j a va 2 s .c o m*/ String legacyExport = (String) ContextManagerFactory.instance() .getProperty("jaffa.widgets.exportToExcel.legacy"); if (legacyExport != null && legacyExport.equals("T")) { wb = new HSSFWorkbook(); } else { wb = new SXSSFWorkbook(100); } try { // Creating worksheet Sheet sheet = null; if (sheetName != null) { if (sheetName.length() > 31) sheetName = sheetName.substring(0, 31); char replaceChar = '_'; sheetName = sheetName.replace('\u0003', replaceChar).replace(':', replaceChar) .replace('/', replaceChar).replace("\\\\", Character.toString(replaceChar)) .replace('?', replaceChar).replace('*', replaceChar).replace(']', replaceChar) .replace('[', replaceChar); sheet = wb.createSheet(sheetName); } else sheet = wb.createSheet(); // creating a custom palette for the workbook CellStyle style = wb.createCellStyle(); style = wb.createCellStyle(); // setting the foreground color to gray style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); style.setFillPattern(CellStyle.SOLID_FOREGROUND); // Setting the border for the cells style.setBorderBottom(CellStyle.BORDER_THIN); style.setBottomBorderColor(IndexedColors.BLACK.getIndex()); style.setBorderLeft(CellStyle.BORDER_THIN); style.setLeftBorderColor(IndexedColors.GREEN.getIndex()); style.setBorderRight(CellStyle.BORDER_THIN); style.setRightBorderColor(IndexedColors.BLACK.getIndex()); style.setBorderTop(CellStyle.BORDER_THIN); style.setTopBorderColor(IndexedColors.BLACK.getIndex()); style.setAlignment(CellStyle.ALIGN_CENTER); // setting font weight Font titleFont = wb.createFont(); titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD); style.setFont(titleFont); int rowNum = 0; Row headerRow = sheet.createRow(rowNum); int colIndex = 0; for (Object o : master.getColumnModel()) { String columnTitle = (String) ((DynaBean) o).get("header"); if (columnTitle == null || columnTitle.length() == 0) columnTitle = (String) ((DynaBean) o).get("mapping"); headerRow.createCell(colIndex).setCellValue(columnTitle); Cell cell = headerRow.getCell(colIndex); cell.setCellStyle(style); sheet.autoSizeColumn(colIndex); colIndex += 1; } // Generate the Excel output by creating a simple HTML table if (child != null) { for (Object o : child.getColumnModel()) { String columnTitle = (String) ((DynaBean) o).get("header"); if (columnTitle == null || columnTitle.length() == 0) columnTitle = (String) ((DynaBean) o).get("mapping"); headerRow.createCell(colIndex).setCellValue(columnTitle); Cell cell = headerRow.getCell(colIndex); cell.setCellStyle(style); sheet.autoSizeColumn(colIndex); colIndex += 1; } } // Invoke the query and obtain an array of Graph objects Object[] queryOutput = invokeQueryService(master.getCriteriaClassName(), master.getCriteriaObject(), master.getServiceClassName(), master.getServiceClassMethodName()); // Add the data rows if (queryOutput != null) { for (Object row : queryOutput) { Object[] detailQueryOutput = new Object[0]; if (child == null) { rowNum += 1; Row dataRow = sheet.createRow((short) rowNum); int colNum = 0; // extract the columns from master object for (Object o : master.getColumnModel()) { String mapping = (String) ((DynaBean) o).get("mapping"); Object value = null; try { value = PropertyUtils.getProperty(row, mapping); } catch (Exception e) { if (log.isDebugEnabled()) log.debug("Property not found: " + mapping, e); } dataRow.createCell(colNum).setCellValue(format(value, (DynaBean) o)); colNum += 1; } } else { //child is not null // load the child rows String detailCriteriaObject = child.getCriteriaObject(); for (int i = 0; i < child.getMasterKeyFieldNames().length; i++) { String kfn = child.getMasterKeyFieldNames()[i]; try { String keyValue = (String) PropertyUtils.getProperty(row, kfn); detailCriteriaObject = detailCriteriaObject.replace("{" + i + "}", keyValue); } catch (Exception e) { if (log.isDebugEnabled()) log.debug("Key property not found: " + kfn, e); } } detailQueryOutput = invokeQueryService(child.getCriteriaClassName(), detailCriteriaObject, child.getServiceClassName(), "query"); // add the child columns if (detailQueryOutput != null && detailQueryOutput.length > 0) { for (Object detailRow : detailQueryOutput) { rowNum += 1; Row dataRow = sheet.createRow((short) rowNum); int colNum = 0; // extract the columns from master object for (Object obj : master.getColumnModel()) { String masterMapping = (String) ((DynaBean) obj).get("mapping"); Object masterValue = null; try { masterValue = PropertyUtils.getProperty(row, masterMapping); } catch (Exception e) { if (log.isDebugEnabled()) log.debug("Property not found: " + masterMapping, e); } dataRow.createCell(colNum).setCellValue(format(masterValue, (DynaBean) obj)); colNum += 1; } for (Object o : child.getColumnModel()) { String mapping = (String) ((DynaBean) o).get("mapping"); Object value = null; try { value = PropertyUtils.getProperty(detailRow, mapping); } catch (Exception e) { if (log.isDebugEnabled()) log.debug("Property not found in child result: " + mapping, e); } dataRow.createCell(colNum).setCellValue(format(value, (DynaBean) o)); colNum += 1; } } } } } } } catch (Exception e) { e.printStackTrace(); } return wb; }
From source file:org.netxilia.impexp.impl.PoiUtils.java
License:Open Source License
public static CellStyle netxiliaStyle2Poi(Styles nxStyle, Workbook workbook, CellStyle poiStyle) { if (nxStyle == null) { return poiStyle; }/*from w w w . j a v a 2s.c o m*/ poiStyle.setWrapText(nxStyle.contains(DefaultStyle.nowrap.getStyle())); // font short bold = nxStyle.contains(DefaultStyle.bold.getStyle()) ? Font.BOLDWEIGHT_BOLD : Font.BOLDWEIGHT_NORMAL; byte underline = nxStyle.contains(DefaultStyle.underline.getStyle()) ? Font.U_SINGLE : Font.U_NONE; boolean italic = nxStyle.contains(DefaultStyle.italic.getStyle()); boolean strikeout = nxStyle.contains(DefaultStyle.strikeout.getStyle()); Font defaultFont = workbook.getFontAt(poiStyle.getFontIndex()); Font font = workbook.findFont(bold, defaultFont.getColor(), defaultFont.getFontHeight(), defaultFont.getFontName(), italic, strikeout, defaultFont.getTypeOffset(), underline); if (font == null) { font = workbook.createFont(); font.setBoldweight(bold); font.setItalic(italic); font.setUnderline(underline); font.setStrikeout(strikeout); } poiStyle.setFont(font); // borders if (nxStyle.contains(DefaultStyle.borderLeft.getStyle())) { poiStyle.setBorderLeft(CellStyle.BORDER_THIN); } if (nxStyle.contains(DefaultStyle.borderRight.getStyle())) { poiStyle.setBorderRight(CellStyle.BORDER_THIN); } if (nxStyle.contains(DefaultStyle.borderTop.getStyle())) { poiStyle.setBorderTop(CellStyle.BORDER_THIN); } if (nxStyle.contains(DefaultStyle.borderBottom.getStyle())) { poiStyle.setBorderBottom(CellStyle.BORDER_THIN); } // align if (nxStyle.contains(DefaultStyle.alignLeft.getStyle())) { poiStyle.setAlignment(CellStyle.ALIGN_LEFT); } else if (nxStyle.contains(DefaultStyle.alignRight.getStyle())) { poiStyle.setAlignment(CellStyle.ALIGN_RIGHT); } else if (nxStyle.contains(DefaultStyle.alignCenter.getStyle())) { poiStyle.setAlignment(CellStyle.ALIGN_CENTER); } else if (nxStyle.contains(DefaultStyle.alignJustify.getStyle())) { poiStyle.setAlignment(CellStyle.ALIGN_JUSTIFY); } return poiStyle; }
From source file:org.phenotips.export.internal.Styler.java
License:Open Source License
public void style(DataCell dataCell, Cell cell, Workbook wBook) { Set<StyleOption> styles = dataCell.getStyles(); CellStyle cellStyle = wBook.createCellStyle(); /* For \n to work properly set to true */ cellStyle.setWrapText(true);/*w w w .j av a 2s .co m*/ if (this.defaultFont == null) { this.defaultFont = createDefaultFont(wBook); } cellStyle.setFont(this.defaultFont); if (styles == null) { if (this.styleCache.containsKey(Collections.<StyleOption>emptySet())) { cell.setCellStyle(this.styleCache.get(Collections.<StyleOption>emptySet())); return; } cell.setCellStyle(cellStyle); this.styleCache.put(Collections.<StyleOption>emptySet(), cellStyle); return; } if (this.styleCache.containsKey(styles)) { cell.setCellStyle(this.styleCache.get(styles)); return; } /* Priority can be coded in by placing the if statement lower, for higher priority */ /** Font styles */ Font headerFont = null; if (styles.contains(StyleOption.HEADER)) { headerFont = wBook.createFont(); headerFont.setBoldweight(Font.BOLDWEIGHT_BOLD); cellStyle.setFont(headerFont); cellStyle.setAlignment(CellStyle.ALIGN_CENTER); cellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER); cell.setCellStyle(cellStyle); } if (styles.contains(StyleOption.LARGE_HEADER)) { if (headerFont == null) { headerFont = wBook.createFont(); headerFont.setBoldweight(Font.BOLDWEIGHT_BOLD); } headerFont.setFontHeightInPoints((short) 12); cellStyle.setFont(headerFont); cell.setCellStyle(cellStyle); } if (styles.contains(StyleOption.YES)) { Font font = createDefaultFont(wBook); font.setColor(HSSFColor.GREEN.index); cellStyle.setFont(font); cell.setCellStyle(cellStyle); } if (styles.contains(StyleOption.NO)) { Font font = createDefaultFont(wBook); font.setColor(HSSFColor.DARK_RED.index); font.setBoldweight(Font.BOLDWEIGHT_BOLD); cellStyle.setFont(font); cell.setCellStyle(cellStyle); } /** Border styles */ if (styles.contains(StyleOption.HEADER_BOTTOM)) { cellStyle.setBorderBottom(CellStyle.BORDER_MEDIUM); cell.setCellStyle(cellStyle); } if (styles.contains(StyleOption.SECTION_BORDER_LEFT)) { cellStyle.setBorderLeft(CellStyle.BORDER_MEDIUM); cell.setCellStyle(cellStyle); } if (styles.contains(StyleOption.SECTION_BORDER_RIGHT)) { cellStyle.setBorderRight(CellStyle.BORDER_MEDIUM); cell.setCellStyle(cellStyle); } if (styles.contains(StyleOption.PATIENT_BORDER)) { cellStyle.setBorderBottom(CellStyle.BORDER_THIN); cell.setCellStyle(cellStyle); } if (styles.contains(StyleOption.FEATURE_SEPARATOR)) { cellStyle.setBorderTop(CellStyle.BORDER_THIN); cellStyle.setTopBorderColor(IndexedColors.GREY_25_PERCENT.getIndex()); cell.setCellStyle(cellStyle); } if (styles.contains(StyleOption.YES_NO_SEPARATOR)) { cellStyle.setBorderTop(CellStyle.BORDER_DASHED); cellStyle.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); cell.setCellStyle(cellStyle); } /* Keep this as the last statement. */ this.styleCache.put(styles, cellStyle); }
From source file:org.projectforge.excel.XlsContentProvider.java
License:Open Source License
@Override public XlsContentProvider updateCellStyle(final ExportCell cell) { final CellFormat format = cell.ensureAndGetCellFormat(); CellStyle cellStyle = reusableCellFormats.get(format); if (cellStyle == null) { cellStyle = workbook.createCellStyle(); reusableCellFormats.put(format, cellStyle); format.copyToCellStyle(cellStyle); if (format.getFillForegroundColor() != null) { cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); }//from ww w. ja v a 2 s . c o m cellStyle.setBorderBottom((short) 1); cellStyle.setBorderLeft((short) 1); cellStyle.setBorderRight((short) 1); cellStyle.setBorderTop((short) 1); cellStyle.setWrapText(true); final String dataFormat = format.getDataFormat(); if (dataFormat != null) { final short df = workbook.getDataFormat(format.getDataFormat()); cellStyle.setDataFormat(df); } } cell.setCellStyle(cellStyle); return this; }
From source file:org.projectforge.export.XlsContentProvider.java
License:Open Source License
public void updateCellStyle(final ExportCell cell) { final CellFormat format = cell.ensureAndGetCellFormat(); CellStyle cellStyle = reusableCellFormats.get(format); if (cellStyle == null) { cellStyle = workbook.createCellStyle(); reusableCellFormats.put(format, cellStyle); format.copyToCellStyle(cellStyle); if (format.getFillForegroundColor() != null) { cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); }/*from www.j a va2s . co m*/ cellStyle.setBorderBottom((short) 1); cellStyle.setBorderLeft((short) 1); cellStyle.setBorderRight((short) 1); cellStyle.setBorderTop((short) 1); cellStyle.setWrapText(true); final String dataFormat = format.getDataFormat(); if (dataFormat != null) { final short df = workbook.getDataFormat(format.getDataFormat()); cellStyle.setDataFormat(df); } } cell.setCellStyle(cellStyle); }
From source file:org.sakaiproject.signup.tool.downloadEvents.WorksheetStyleClass.java
License:Educational Community License
public static Map<String, CellStyle> createStyles(Workbook wb) { Map<String, CellStyle> styles = new HashMap<String, CellStyle>(); CellStyle style; Font titleFont = wb.createFont(); titleFont.setFontHeightInPoints((short) 18); titleFont.setBoldweight(Font.BOLDWEIGHT_BOLD); titleFont.setColor(IndexedColors.DARK_BLUE.getIndex()); style = wb.createCellStyle();// ww w.j a v a 2s . com style.setAlignment(CellStyle.ALIGN_CENTER); style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); style.setFont(titleFont); styles.put("title", style); Font commentTitleFont = wb.createFont(); commentTitleFont.setFontHeightInPoints((short) 12); commentTitleFont.setBoldweight(Font.BOLDWEIGHT_BOLD); commentTitleFont.setColor(IndexedColors.DARK_BLUE.getIndex()); style = wb.createCellStyle(); style.setAlignment(CellStyle.ALIGN_LEFT); style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); style.setFont(commentTitleFont); styles.put("commentTitle", style); Font itemFont = wb.createFont(); itemFont.setFontHeightInPoints((short) 10); itemFont.setFontName("Trebuchet MS"); style = wb.createCellStyle(); style.setAlignment(CellStyle.ALIGN_LEFT); style.setFont(itemFont); styles.put("item_left", style); style = wb.createCellStyle(); style.setAlignment(CellStyle.ALIGN_LEFT); style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); style.setFont(itemFont); style.setWrapText(true); styles.put("item_left_wrap", style); style = wb.createCellStyle(); style.setAlignment(CellStyle.ALIGN_LEFT); style.setVerticalAlignment(CellStyle.VERTICAL_TOP); style.setFont(itemFont); style.setWrapText(true); styles.put("item_left_wrap_top", style); itemFont.setFontHeightInPoints((short) 10); itemFont.setFontName("Trebuchet MS"); style = wb.createCellStyle(); style.setAlignment(CellStyle.ALIGN_CENTER); style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); style.setFont(itemFont); styles.put("tabItem_fields", style); style = wb.createCellStyle(); style.setAlignment(CellStyle.ALIGN_RIGHT); style.setFont(itemFont); styles.put("item_right", style); style = wb.createCellStyle(); style.setAlignment(CellStyle.ALIGN_CENTER); style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); style.setFont(itemFont); style.setWrapText(true); styles.put("attendee_layout", style); Font itemBoldFont = wb.createFont(); itemBoldFont.setFontHeightInPoints((short) 10); itemBoldFont.setFontName("Trebuchet MS"); itemBoldFont.setColor(IndexedColors.DARK_BLUE.getIndex()); style = wb.createCellStyle(); style.setAlignment(CellStyle.ALIGN_LEFT); style.setVerticalAlignment(CellStyle.VERTICAL_TOP); itemBoldFont.setBoldweight(Font.BOLDWEIGHT_BOLD); style.setFont(itemBoldFont); styles.put("item_leftBold", style); Font tableFont = wb.createFont(); tableFont.setFontHeightInPoints((short) 12); tableFont.setColor(IndexedColors.WHITE.getIndex()); tableFont.setBoldweight(Font.BOLDWEIGHT_BOLD); style = wb.createCellStyle(); style.setAlignment(CellStyle.ALIGN_CENTER); style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); style.setFillForegroundColor(IndexedColors.DARK_BLUE.getIndex()); style.setFillPattern(CellStyle.SOLID_FOREGROUND); style.setFont(tableFont); styles.put("tabColNames", style); tableFont.setFontHeightInPoints((short) 10); tableFont.setColor(IndexedColors.WHITE.getIndex()); style = wb.createCellStyle(); style.setAlignment(CellStyle.ALIGN_CENTER); style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); style.setFillForegroundColor(IndexedColors.GREY_50_PERCENT.getIndex()); style.setFillPattern(CellStyle.SOLID_FOREGROUND); style.setFont(tableFont); style.setWrapText(true); styles.put("header", style); Font linkFont = wb.createFont(); linkFont.setFontHeightInPoints((short) 10); linkFont.setColor(IndexedColors.BLUE.getIndex()); linkFont.setUnderline(Font.U_SINGLE); style = wb.createCellStyle(); style.setAlignment(CellStyle.ALIGN_LEFT); style.setVerticalAlignment(CellStyle.VERTICAL_CENTER); style.setFont(linkFont); styles.put("hyperLink", style); style = wb.createCellStyle(); style.setBorderTop(CellStyle.BORDER_THICK); style.setTopBorderColor(IndexedColors.DARK_BLUE.getIndex()); styles.put("tab_endline", style); return styles; }