List of usage examples for org.apache.poi.ss.usermodel CellStyle setBorderTop
void setBorderTop(BorderStyle border);
From source file:com.ipcglobal.fredimport.xls.BaseXls.java
License:Apache License
/** * Adds the border to style.// w ww . j a v a 2s.com * * @param style the style * @param cellBorder the cell border * @throws Exception the exception */ protected void addBorderToStyle(CellStyle style, CellBorder cellBorder) throws Exception { if (cellBorder == CellBorder.All_Thin || cellBorder == CellBorder.Bottom_Thin) { style.setBorderBottom(CellStyle.BORDER_THIN); style.setBottomBorderColor(IndexedColors.BLACK.getIndex()); } if (cellBorder == CellBorder.All_Thin || cellBorder == CellBorder.Left_Thin) { style.setBorderLeft(CellStyle.BORDER_THIN); style.setLeftBorderColor(IndexedColors.BLACK.getIndex()); } if (cellBorder == CellBorder.All_Thin || cellBorder == CellBorder.Right_Thin) { style.setBorderRight(CellStyle.BORDER_THIN); style.setRightBorderColor(IndexedColors.BLACK.getIndex()); } if (cellBorder == CellBorder.All_Thin || cellBorder == CellBorder.Top_Thin) { style.setBorderTop(CellStyle.BORDER_THIN); style.setTopBorderColor(IndexedColors.BLACK.getIndex()); } if (cellBorder == CellBorder.All_Medium || cellBorder == CellBorder.Bottom_Medium) { style.setBorderBottom(CellStyle.BORDER_MEDIUM); style.setBottomBorderColor(IndexedColors.BLACK.getIndex()); } if (cellBorder == CellBorder.All_Medium || cellBorder == CellBorder.Left_Medium) { style.setBorderLeft(CellStyle.BORDER_MEDIUM); style.setLeftBorderColor(IndexedColors.BLACK.getIndex()); } if (cellBorder == CellBorder.All_Medium || cellBorder == CellBorder.Right_Medium) { style.setBorderRight(CellStyle.BORDER_MEDIUM); style.setRightBorderColor(IndexedColors.BLACK.getIndex()); } if (cellBorder == CellBorder.All_Medium || cellBorder == CellBorder.Top_Medium) { style.setBorderTop(CellStyle.BORDER_MEDIUM); style.setTopBorderColor(IndexedColors.BLACK.getIndex()); } if (cellBorder == CellBorder.All_Thick || cellBorder == CellBorder.Bottom_Thick) { style.setBorderBottom(CellStyle.BORDER_THICK); style.setBottomBorderColor(IndexedColors.BLACK.getIndex()); } if (cellBorder == CellBorder.All_Thick || cellBorder == CellBorder.Left_Thick) { style.setBorderLeft(CellStyle.BORDER_THICK); style.setLeftBorderColor(IndexedColors.BLACK.getIndex()); } if (cellBorder == CellBorder.All_Thick || cellBorder == CellBorder.Right_Thick) { style.setBorderRight(CellStyle.BORDER_THICK); style.setRightBorderColor(IndexedColors.BLACK.getIndex()); } if (cellBorder == CellBorder.All_Thick || cellBorder == CellBorder.Top_Thick) { style.setBorderTop(CellStyle.BORDER_THICK); style.setTopBorderColor(IndexedColors.BLACK.getIndex()); } }
From source file:com.liferay.portlet.documentlibrary.action.EditEntryAction.java
License:Open Source License
public static void exportDocumentData(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws NumberFormatException, PortalException, SystemException { long file_id = 0; String fileEntryIds = ParamUtil.getString(resourceRequest, "fileEntryIds"); String[] fileentires = fileEntryIds.split(","); List<Long> tempResults = new ArrayList<Long>(); if (!fileEntryIds.isEmpty()) { if (fileentires[0].equals("true")) { for (int i = 1; i < fileentires.length; i++) { DLFileEntry FileEntry = DLFileEntryLocalServiceUtil .getDLFileEntry(Long.parseLong(fileentires[i])); file_id = FileEntry.getFileEntryId(); tempResults.add(file_id); }// ww w . j a v a 2 s . c o m } else { for (int i = 0; i < fileentires.length; i++) { DLFileEntry FileEntry = DLFileEntryLocalServiceUtil .getDLFileEntry(Long.parseLong(fileentires[i])); file_id = FileEntry.getFileEntryId(); tempResults.add(file_id); } } } try { HSSFWorkbook hwb = new HSSFWorkbook(); HSSFSheet sheet = hwb.createSheet("Site Information"); org.apache.poi.ss.usermodel.Font font = hwb.createFont(); font.setFontHeightInPoints((short) 11); font.setFontName("Arial"); font.setItalic(false); font.setStrikeout(false); font.setBoldweight(org.apache.poi.ss.usermodel.Font.BOLDWEIGHT_BOLD); CellStyle style = hwb.createCellStyle(); style.setBorderBottom(CellStyle.BORDER_THIN); style.setBorderLeft(CellStyle.BORDER_THIN); style.setBorderTop(CellStyle.BORDER_THIN); style.setBorderRight(CellStyle.BORDER_THIN); style.setBorderBottom(CellStyle.BORDER_THIN); style.setBottomBorderColor(HSSFColor.BLACK.index); style.setFont(font); CellStyle filterStyle = hwb.createCellStyle(); org.apache.poi.ss.usermodel.Font filterfont = hwb.createFont(); filterfont.setFontHeightInPoints((short) 9); filterfont.setFontName("Courier New"); filterfont.setItalic(false); filterfont.setStrikeout(false); filterfont.setBoldweight(org.apache.poi.ss.usermodel.Font.BOLDWEIGHT_BOLD); filterStyle.setFont(filterfont); filterStyle.setBorderBottom(CellStyle.BORDER_THIN); filterStyle.setBorderLeft(CellStyle.BORDER_THIN); filterStyle.setBorderTop(CellStyle.BORDER_THIN); filterStyle.setBorderRight(CellStyle.BORDER_THIN); HSSFRow rowhead = sheet.createRow((short) 2); rowhead.createCell((short) 0).setCellValue("S.No."); rowhead.createCell((short) 1).setCellValue("Title "); rowhead.createCell((short) 2).setCellValue("Site Name "); rowhead.createCell((short) 3).setCellValue("Category Type"); rowhead.createCell((short) 4).setCellValue("Com"); rowhead.createCell((short) 5).setCellValue("Upload Date"); rowhead.createCell((short) 6).setCellValue("File Type"); int index = 3; int sno = 0; for (int i = 0; i < tempResults.size(); i++) { sno++; DLFileEntry objdlfileentry = DLFileEntryLocalServiceUtil.getDLFileEntry(tempResults.get(i)); docs_customData objdocs_customData = null; try { objdocs_customData = docs_customDataLocalServiceUtil.getfileEntry(tempResults.get(i)); } catch (Exception e) { // TODO Auto-generated catch block //e.printStackTrace(); } String com = ""; if (objdocs_customData != null) { com = objdocs_customData.getCom(); } String siteName = ""; if (objdocs_customData != null) { siteName = objdocs_customData.getSite(); } String doccategory = ""; if (objdocs_customData != null) { doccategory = objdocs_customData.getCategory(); } HSSFRow row = sheet.createRow((short) index); row.createCell((short) 0).setCellValue(sno); row.createCell((short) 1).setCellValue(objdlfileentry.getTitle()); row.createCell((short) 2).setCellValue(siteName); row.createCell((short) 3).setCellValue(doccategory); row.createCell((short) 4).setCellValue(com); row.createCell((short) 5).setCellValue(objdlfileentry.getModifiedDate()); row.createCell((short) 6).setCellValue(objdlfileentry.getMimeType()); index++; } resourceResponse.setContentType("application/vnd.ms-excel"); resourceResponse.addProperty("Content-Disposition", "attachment;filename=Document_Listing.xls"); OutputStream fileOut = resourceResponse.getPortletOutputStream(); hwb.write(fileOut); fileOut.close(); } catch (Exception ex) { ex.printStackTrace(); } }
From source file:com.lw.common.utils.ExcelUtil.java
/** * excel//w w w. j av a 2s . co m * @param list ? * @param keys listmapkey? * @param columnNames excel?? * */ public static Workbook createWorkBook(List<Map<String, Object>> list, String[] keys, String columnNames[]) { // excel Workbook wb = new HSSFWorkbook(); // sheet?? Sheet sheet = wb.createSheet(list.get(0).get("sheetName").toString()); // ???n? for (int i = 0; i < keys.length; i++) { sheet.setColumnWidth((short) i, (short) (35.7 * 150)); } // Row row = sheet.createRow((short) 0); // ??? CellStyle cs = wb.createCellStyle(); CellStyle cs2 = wb.createCellStyle(); // ? Font f = wb.createFont(); Font f2 = wb.createFont(); // ???? f.setFontHeightInPoints((short) 10); f.setColor(IndexedColors.BLACK.getIndex()); f.setBoldweight(Font.BOLDWEIGHT_BOLD); // ?? f2.setFontHeightInPoints((short) 10); f2.setColor(IndexedColors.BLACK.getIndex()); // Font f3=wb.createFont(); // f3.setFontHeightInPoints((short) 10); // f3.setColor(IndexedColors.RED.getIndex()); // ????? cs.setFont(f); cs.setBorderLeft(CellStyle.BORDER_THIN); cs.setBorderRight(CellStyle.BORDER_THIN); cs.setBorderTop(CellStyle.BORDER_THIN); cs.setBorderBottom(CellStyle.BORDER_THIN); cs.setAlignment(CellStyle.ALIGN_CENTER); // ??? cs2.setFont(f2); cs2.setBorderLeft(CellStyle.BORDER_THIN); cs2.setBorderRight(CellStyle.BORDER_THIN); cs2.setBorderTop(CellStyle.BORDER_THIN); cs2.setBorderBottom(CellStyle.BORDER_THIN); cs2.setAlignment(CellStyle.ALIGN_CENTER); //?? for (int i = 0; i < columnNames.length; i++) { Cell cell = row.createCell(i); cell.setCellValue(columnNames[i]); cell.setCellStyle(cs); } //?? for (short i = 1; i < list.size(); i++) { // Row ,Cell , Row Cell 0 // sheet Row row1 = sheet.createRow((short) i); // row for (short j = 0; j < keys.length; j++) { Cell cell = row1.createCell(j); cell.setCellValue(list.get(i).get(keys[j]) == null ? " " : list.get(i).get(keys[j]).toString()); cell.setCellStyle(cs2); } } return wb; }
From source file:com.lwr.software.reporter.restservices.ReportExportService.java
License:Open Source License
public Response exportExcel(Report toExport, Set<ReportParameter> reportParams) { Workbook wb = new XSSFWorkbook(); Font boldFont = wb.createFont(); boldFont.setBold(true);//from w w w. java 2 s . c o m CellStyle headerStyle = wb.createCellStyle(); headerStyle.setBorderBottom(BorderStyle.THIN); headerStyle.setBorderTop(BorderStyle.THIN); headerStyle.setBorderRight(BorderStyle.THIN); headerStyle.setBorderLeft(BorderStyle.THIN); headerStyle.setFillBackgroundColor(IndexedColors.BLUE.getIndex()); headerStyle.setFont(boldFont); CellStyle cellStyle = wb.createCellStyle(); cellStyle.setBorderBottom(BorderStyle.THIN); cellStyle.setBorderTop(BorderStyle.THIN); cellStyle.setBorderRight(BorderStyle.THIN); cellStyle.setBorderLeft(BorderStyle.THIN); CellStyle titleStyle = wb.createCellStyle(); titleStyle.setBorderBottom(BorderStyle.THIN); titleStyle.setBorderTop(BorderStyle.THIN); titleStyle.setBorderRight(BorderStyle.THIN); titleStyle.setBorderLeft(BorderStyle.THIN); List<RowElement> rows = toExport.getRows(); int sheetIndex = 0; for (RowElement rowElement : rows) { List<Element> elements = rowElement.getElements(); for (Element element : elements) { try { element.setParams(reportParams); element.init(); } catch (Exception e) { logger.error("Unable to init '" + element.getTitle() + "' element of report '" + toExport.getTitle() + "' Error " + e.getMessage(), e); return Response.serverError().entity("Unable to init '" + element.getTitle() + "' element of report '" + toExport.getTitle() + "' Error " + e.getMessage()).build(); } String sheetName = element.getTitle().substring(0, element.getTitle().length() > 30 ? 30 : element.getTitle().length()) + (sheetIndex++); Sheet sheet = wb.createSheet(sheetName); Row reportTitleRow = sheet.createRow(0); Cell reportTitleHeader = reportTitleRow.createCell(0); reportTitleHeader.setCellStyle(headerStyle); reportTitleHeader.setCellValue("Report Title:"); Cell reportTitleCell = reportTitleRow.createCell(1); reportTitleCell.setCellStyle(titleStyle); reportTitleCell.setCellValue(toExport.getTitle()); Row elementTitleRow = sheet.createRow(1); Cell elementTitleHeader = elementTitleRow.createCell(0); elementTitleHeader.setCellStyle(headerStyle); elementTitleHeader.setCellValue("Element Title:"); Cell elementTitleCell = elementTitleRow.createCell(1); elementTitleCell.setCellStyle(titleStyle); elementTitleCell.setCellValue(element.getTitle()); List<List<Object>> dataToExport = element.getData(); int rowIndex = 3; Row headerRow = sheet.createRow(rowIndex++); List<Object> unifiedHeaderRow = element.getHeader(); for (int i = 0; i < unifiedHeaderRow.size(); i++) { Cell headerCell = headerRow.createCell(i); String headerCellValue = unifiedHeaderRow.get(i).toString(); headerCell.setCellValue(headerCellValue); headerCell.setCellStyle(headerStyle); } for (int i = 0; i < dataToExport.size(); i++) { Row row = sheet.createRow(rowIndex++); List<Object> unifiedRow = dataToExport.get(i); int cellIndex = 0; for (Object cellValue : unifiedRow) { Cell cell = row.createCell(cellIndex); cell.setCellStyle(cellStyle); try { double val = Double.parseDouble(cellValue.toString()); cell.setCellValue(val); } catch (NumberFormatException e) { cell.setCellValue(cellValue.toString()); } cellIndex++; } } } } try { File file = new File(DashboardConstants.APPLN_TEMP_DIR + System.nanoTime()); logger.info("Export CSV temp file path is " + file.getAbsoluteFile()); wb.write(new FileOutputStream(file)); wb.close(); ResponseBuilder responseBuilder = Response.ok((Object) file); responseBuilder.header("Content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); responseBuilder.header("Content-Transfer-Encoding", "binary"); responseBuilder.header("Content-Disposition", "attachment;filename=" + file.getName()); responseBuilder.header("Content-Length", file.length()); Response responseToSend = responseBuilder.build(); file.deleteOnExit(); return responseToSend; } catch (Exception e1) { return Response.serverError() .entity("Unable to export " + toExport.getTitle() + " report " + e1.getMessage()).build(); } }
From source file:com.nc.common.utils.ExcelUtil.java
License:Open Source License
/** * <pre>/* w w w. j a v a 2 s .c o m*/ * 1. : POI UTIL * 2. : POI WORKBOOK ? / String , List<Map<String, Object>> ? , List<Map<String, Object>> * </pre> * * @method Name : createWorkBook * @param workbook, sheetName, list, colNames * @return Workbook * @throws Exception * */ @SuppressWarnings("deprecation") public static Workbook createWorkBook(Workbook workbook, String sheetName, List<Map<String, Object>> list, List<Map<String, Object>> colNames) throws Exception { Row row; Cell cell; /* ? ? START */ /* Workbook workbook = new Workbook(); */ CellStyle titleStyle = workbook.createCellStyle(); CellStyle cellStyle = workbook.createCellStyle(); CellStyle contentStyle = workbook.createCellStyle(); CellStyle contentStyle_2 = workbook.createCellStyle(); /* ? */ /* ? ? */ Font titleFont = workbook.createFont(); titleFont.setFontHeightInPoints((short) 13); titleFont.setFontName("? "); /* ? */ Font colNameFont = workbook.createFont(); colNameFont.setFontHeightInPoints((short) 10); colNameFont.setFontName("? "); /* ? */ Font contentFont = workbook.createFont(); /* ? ? ? */ titleStyle.setFont(titleFont); /* ? / ? ? */ cellStyle.setFillForegroundColor(HSSFColor.GREY_25_PERCENT.index); /* ? */ cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);//? cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN); cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN); cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); cellStyle.setFont(colNameFont); /* ? / ? */ contentStyle.setBorderRight(HSSFCellStyle.BORDER_THIN); /* ? */ contentStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN); contentStyle.setBorderTop(HSSFCellStyle.BORDER_THIN); contentStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); contentStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); contentStyle.setFont(contentFont); /* ? / ? */ contentStyle_2.setBorderRight(HSSFCellStyle.BORDER_THIN); /* ? */ contentStyle_2.setBorderLeft(HSSFCellStyle.BORDER_THIN); contentStyle_2.setBorderTop(HSSFCellStyle.BORDER_THIN); contentStyle_2.setBorderBottom(HSSFCellStyle.BORDER_THIN); contentStyle_2.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); contentStyle_2.setAlignment(HSSFCellStyle.ALIGN_LEFT); contentStyle_2.setFont(contentFont); /* ? */ Sheet sheet = workbook.createSheet(sheetName); /* ?? */ int sheet1_row = 0; List<Map<String, Object>> colList = colNames; /* ? START */ row = sheet.createRow(sheet1_row); for (int i = 0; i < colList.size(); i++) { cell = row.createCell(i); cell.setCellValue(String.valueOf(colList.get(i).get("item" + i))); cell.setCellStyle(cellStyle); } sheet1_row++; /* ? END */ for (Map<String, Object> map : list) { row = sheet.createRow(sheet1_row); for (int j = 0; j < colList.size(); j++) { cell = row.createCell(j); cell.setCellStyle(contentStyle); if (null != map.get(colList.get(j).get("item" + j))) { cell.setCellValue((double) map.get(String.valueOf(colList.get(j).get("item" + j)))); } else { cell.setCellValue(""); } /* ? ?? */ sheet.autoSizeColumn((short) j); sheet.setColumnWidth(j, (sheet.getColumnWidth(j)) + 312); } sheet1_row++; } return workbook; }
From source file:com.ncc.excel.test.ExcelUtil.java
License:Apache License
/** * ????? //from w w w .ja va 2s . com * * @param fromStyle * @param toStyle */ public static void copyCellStyle(CellStyle fromStyle, CellStyle toStyle) { toStyle.setAlignment(fromStyle.getAlignment()); // toStyle.setBorderBottom(fromStyle.getBorderBottom()); toStyle.setBorderLeft(fromStyle.getBorderLeft()); toStyle.setBorderRight(fromStyle.getBorderRight()); toStyle.setBorderTop(fromStyle.getBorderTop()); 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.getFillPattern()); // toStyle.setFont(fromStyle.getFont(null)); toStyle.setHidden(fromStyle.getHidden()); toStyle.setIndention(fromStyle.getIndention());// toStyle.setLocked(fromStyle.getLocked()); toStyle.setRotation(fromStyle.getRotation());// toStyle.setVerticalAlignment(fromStyle.getVerticalAlignment()); toStyle.setWrapText(fromStyle.getWrapText()); }
From source file:com.netxforge.netxstudio.server.logic.reporting.BaseComponentReportingLogic.java
License:Open Source License
public void createHeaderStructure(HSSFSheet sheet) { CellStyle baseStyle = this.getWorkBook().createCellStyle(); baseStyle.setBorderTop(CellStyle.BORDER_MEDIUM); baseStyle.setBorderBottom(CellStyle.BORDER_MEDIUM); baseStyle.setBorderLeft(CellStyle.BORDER_MEDIUM); baseStyle.setBorderRight(CellStyle.BORDER_MEDIUM); baseStyle.setAlignment(CellStyle.ALIGN_LEFT); CellStyle typeStyle = this.getWorkBook().createCellStyle(); typeStyle.cloneStyleFrom(baseStyle); Font typeFont = getWorkBook().createFont(); typeFont.setFontHeightInPoints((short) 24); typeStyle.setFont(typeFont);/* ww w .ja v a2 s . com*/ HSSFRow typeRow = sheet.createRow(0); typeCell = typeRow.createCell(0); typeCell.setCellValue("<Service Type>"); typeCell.setCellStyle(typeStyle); for (int i = 1; i < HEADER_CELL_SIZE; i++) { typeRow.createCell(i).setCellStyle(typeStyle); } CellStyle titleStyle = this.getWorkBook().createCellStyle(); titleStyle.cloneStyleFrom(baseStyle); Font titleFont = getWorkBook().createFont(); titleFont.setFontHeightInPoints((short) 16); titleStyle.setFont(titleFont); HSSFRow titleRow = sheet.createRow(1); titleCell = titleRow.createCell(0); titleCell.setCellValue("<Report title>"); titleCell.setCellStyle(titleStyle); for (int i = 1; i < HEADER_CELL_SIZE; i++) { titleRow.createCell(i).setCellStyle(titleStyle); } HSSFRow periodRow = sheet.createRow(2); periodCell = periodRow.createCell(0); periodCell.setCellValue("<Period>"); periodCell.setCellStyle(titleStyle); for (int i = 1; i < HEADER_CELL_SIZE; i++) { periodRow.createCell(i).setCellStyle(typeStyle); } // Merge sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, HEADER_CELL_SIZE - 1)); sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, HEADER_CELL_SIZE - 1)); sheet.addMergedRegion(new CellRangeAddress(2, 2, 0, HEADER_CELL_SIZE - 1)); }
From source file:com.netxforge.netxstudio.server.logic.reporting.BaseNodeReportingLogic.java
License:Open Source License
public void createHeaderStructure(Sheet sheet) { CellStyle baseStyle = this.getWorkBook().createCellStyle(); baseStyle.setBorderTop(CellStyle.BORDER_MEDIUM); baseStyle.setBorderBottom(CellStyle.BORDER_MEDIUM); baseStyle.setBorderLeft(CellStyle.BORDER_MEDIUM); baseStyle.setBorderRight(CellStyle.BORDER_MEDIUM); baseStyle.setAlignment(CellStyle.ALIGN_LEFT); CellStyle typeStyle = this.getWorkBook().createCellStyle(); typeStyle.cloneStyleFrom(baseStyle); Font typeFont = getWorkBook().createFont(); typeFont.setFontHeightInPoints((short) 24); typeStyle.setFont(typeFont);//from w w w . ja v a2s . co m Row typeRow = sheet.createRow(0); typeCell = typeRow.createCell(0); typeCell.setCellValue("<Service Type>"); typeCell.setCellStyle(typeStyle); for (int i = 1; i < HEADER_CELL_SIZE; i++) { typeRow.createCell(i).setCellStyle(typeStyle); } CellStyle titleStyle = this.getWorkBook().createCellStyle(); titleStyle.cloneStyleFrom(baseStyle); Font titleFont = getWorkBook().createFont(); titleFont.setFontHeightInPoints((short) 16); titleStyle.setFont(titleFont); Row titleRow = sheet.createRow(1); titleCell = titleRow.createCell(0); titleCell.setCellValue("<Report title>"); titleCell.setCellStyle(titleStyle); for (int i = 1; i < HEADER_CELL_SIZE; i++) { titleRow.createCell(i).setCellStyle(titleStyle); } Row periodRow = sheet.createRow(2); periodCell = periodRow.createCell(0); periodCell.setCellValue("<Period>"); periodCell.setCellStyle(titleStyle); for (int i = 1; i < HEADER_CELL_SIZE; i++) { periodRow.createCell(i).setCellStyle(typeStyle); } // Merge sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, HEADER_CELL_SIZE - 1)); sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, HEADER_CELL_SIZE - 1)); sheet.addMergedRegion(new CellRangeAddress(2, 2, 0, HEADER_CELL_SIZE - 1)); }
From source file:com.netxforge.netxstudio.server.logic.reporting.ResourceReportingEngine.java
License:Open Source License
private CellStyle createAmberBorderStyle() { CellStyle style = this.getWorkBook().createCellStyle(); style.setBorderBottom(CellStyle.BORDER_THIN); style.setBottomBorderColor(IndexedColors.ORANGE.getIndex()); style.setBorderLeft(CellStyle.BORDER_THIN); style.setLeftBorderColor(IndexedColors.ORANGE.getIndex()); style.setBorderRight(CellStyle.BORDER_THIN); style.setRightBorderColor(IndexedColors.ORANGE.getIndex()); style.setBorderTop(CellStyle.BORDER_THIN); style.setTopBorderColor(IndexedColors.ORANGE.getIndex()); return style; }
From source file:com.netxforge.netxstudio.server.logic.reporting.ResourceReportingEngine.java
License:Open Source License
private CellStyle createRedBorderStyle() { CellStyle style = this.getWorkBook().createCellStyle(); style.setBorderBottom(CellStyle.BORDER_THIN); style.setBottomBorderColor(IndexedColors.RED.getIndex()); style.setBorderLeft(CellStyle.BORDER_THIN); style.setLeftBorderColor(IndexedColors.RED.getIndex()); style.setBorderRight(CellStyle.BORDER_THIN); style.setRightBorderColor(IndexedColors.RED.getIndex()); style.setBorderTop(CellStyle.BORDER_THIN); style.setTopBorderColor(IndexedColors.RED.getIndex()); return style; }