List of usage examples for org.apache.poi.ss.usermodel CellStyle setDataFormat
void setDataFormat(short fmt);
From source file:packtest.CreateCell.java
License:Apache License
public static void main(String[] args) throws Exception { Workbook wb = new XSSFWorkbook(); //or new HSSFWorkbook(); CreationHelper creationHelper = wb.getCreationHelper(); Sheet sheet = wb.createSheet("new sheet"); // Create a row and put some cells in it. Rows are 0 based. Row row = sheet.createRow((short) 0); // Create a cell and put a value in it. Cell cell = row.createCell((short) 0); cell.setCellValue(1);//w w w .j a v a2 s . c om //numeric value row.createCell(1).setCellValue(1.2); //plain string value row.createCell(2).setCellValue("This is a string cell"); //rich text string RichTextString str = creationHelper.createRichTextString("Apache"); Font font = wb.createFont(); font.setItalic(true); font.setUnderline(Font.U_SINGLE); str.applyFont(font); row.createCell(3).setCellValue(str); //boolean value row.createCell(4).setCellValue(true); //formula row.createCell(5).setCellFormula("SUM(A1:B1)"); //date CellStyle style = wb.createCellStyle(); style.setDataFormat(creationHelper.createDataFormat().getFormat("m/d/yy h:mm")); cell = row.createCell(6); cell.setCellValue(new Date()); cell.setCellStyle(style); //hyperlink row.createCell(7).setCellFormula("SUM(A1:B1)"); cell.setCellFormula("HYPERLINK(\"http://google.com\",\"Google\")"); // Write the output to a file FileOutputStream fileOut = new FileOutputStream("ooxml-cell.xlsx"); wb.write(fileOut); fileOut.close(); }
From source file:packtest.CreateUserDefinedDataFormats.java
License:Apache License
public static void main(String[] args) throws IOException { Workbook wb = new XSSFWorkbook(); //or new HSSFWorkbook(); Sheet sheet = wb.createSheet("format sheet"); CellStyle style; DataFormat format = wb.createDataFormat(); Row row;//from w w w . ja v a2s .c o m Cell cell; short rowNum = 0; short colNum = 0; row = sheet.createRow(rowNum); cell = row.createCell(colNum); cell.setCellValue(11111.25); style = wb.createCellStyle(); style.setDataFormat(format.getFormat("0.0")); cell.setCellStyle(style); row = sheet.createRow(++rowNum); cell = row.createCell(colNum); cell.setCellValue(11111.25); style = wb.createCellStyle(); style.setDataFormat(format.getFormat("#,##0.0000")); cell.setCellStyle(style); FileOutputStream fileOut = new FileOutputStream("ooxml_dataFormat.xlsx"); wb.write(fileOut); fileOut.close(); wb.close(); }
From source file:paysheets.PaySheetFormatter.java
public static void addTitleRow(HSSFWorkbook workbook) { workbook.createSheet("Sheet 1"); // Each pay sheet only uses the first sheet HSSFSheet sheet = workbook.getSheetAt(0); setDefaultColumnWidth(sheet);/*from w w w . j a va2 s .c o m*/ HSSFRow row; HSSFCell cell; // Create a font and set its attributes Font font = workbook.createFont(); font.setFontHeightInPoints((short) 11); // Set the color to black (constant COLOR_NORMAL) font.setColor(Font.COLOR_NORMAL); font.setBold(true); // Create a cell style and set its properties CellStyle cs = workbook.createCellStyle(); // Set the data format to the built in text format cs.setDataFormat(HSSFDataFormat.getBuiltinFormat("text")); // Set the cell style to use the font created previously cs.setFont(font); // Create the first title row row = sheet.createRow(0); // Use the default row height (-1) is sheet default row.setHeight((short) -1); // Add the first title row's 6 cells for (int cellNum = 0; cellNum < 6; cellNum++) { cell = row.createCell(cellNum); cell.setCellStyle(cs); } // Populate first row's values cell = row.getCell(PaySheet.DATE_INDEX); cell.setCellValue("DATE"); cell = row.getCell(PaySheet.CUST_INDEX); cell.setCellValue("CUSTOMER"); cell = row.getCell(PaySheet.PAY_INDEX); cell.setCellValue("PAY"); cell = row.getCell(PaySheet.NONSERIAL_INDEX); cell.setCellValue("EQUIPMENT"); cell = row.getCell(PaySheet.SERIAL_INDEX); cell.setCellValue("SERIALIZED"); cell = row.getCell(PaySheet.SHS_INDEX); cell.setCellValue("SHS"); // Create second title row row = sheet.createRow(1); row.setHeight((short) -1); // Add the cells to the row for (int cellNum = 0; cellNum < 3; cellNum++) { cell = row.createCell(cellNum); cell.setCellStyle(cs); } // Populate the second title row's values cell = row.getCell(PaySheet.WO_INDEX); cell.setCellValue("WORK ORDER"); cell = row.getCell(PaySheet.TYPE_INDEX); cell.setCellValue("TYPE"); cell = row.getCell(PaySheet.LEP_INDEX); cell.setCellValue("LEP"); // Add thick border around title row addJobBorder(workbook, 0); }
From source file:paysheets.PaySheetFormatter.java
public static void addJobFormatting(HSSFWorkbook workbook, int rowIndex) { HSSFSheet sheet = workbook.getSheetAt(0); HSSFRow row;/*from www. j a v a2 s. c o m*/ HSSFCell cell; Font font = workbook.createFont(); font.setBold(false); font.setFontHeightInPoints((short) 10); font.setColor(Font.COLOR_NORMAL); // Create a cell style for general text CellStyle generalStyle = workbook.createCellStyle(); generalStyle.setFont(font); generalStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("text")); // Create a cell style for dates CellStyle dateStyle = workbook.createCellStyle(); dateStyle.setFont(font); // Set the cell data format to date (0xe) is the built in format dateStyle.setDataFormat((short) 0xe); dateStyle.setAlignment(CellStyle.ALIGN_LEFT); // Create a new row at the given index row = sheet.createRow(rowIndex); // Format the first row for the new job for (int cellNum = 0; cellNum < 6; cellNum++) { cell = row.createCell(cellNum); // Only the first cell uses the date style if (cellNum > 0) { cell.setCellStyle(generalStyle); } else { cell.setCellStyle(dateStyle); } } // Create second row for the new Job at rowIndex + 1 row = sheet.createRow(rowIndex + 1); for (int cellNum = 0; cellNum < 3; cellNum++) { cell = row.createCell(cellNum); cell.setCellStyle(generalStyle); } }
From source file:pl.softech.knf.ofe.opf.members.xls.export.XlsMembersWritter.java
License:Apache License
private void buildHeader(final List<Date> dates, final Sheet sheet, final int rowIdx, final int colIdx) { final Workbook wb = sheet.getWorkbook(); final CreationHelper createHelper = wb.getCreationHelper(); final CellStyle dateCellStyle = wb.createCellStyle(); dateCellStyle.setDataFormat(createHelper.createDataFormat().getFormat("mm-yyyy")); Row row = sheet.createRow(rowIdx);//from w w w . java 2 s.c om Cell cell = row.createCell(colIdx); cell.setCellValue("Open Pension Fund"); final CellStyle cellStyle = wb.createCellStyle(); cellStyle.setAlignment(CellStyle.ALIGN_CENTER); cellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER); cellStyle.setFont(createHeaderFont(wb, (short) 12)); cell.setCellStyle(cellStyle); cell = row.createCell(colIdx + 1); cell.setCellValue("Number of members"); cell.setCellStyle(cellStyle); row = sheet.createRow(rowIdx + 1); sheet.addMergedRegion(new CellRangeAddress(// merge Open Pension Fund rowIdx, // first row (0-based) rowIdx + 1, // last row (0-based) colIdx, // first column (0-based) colIdx // last column (0-based) )); sheet.addMergedRegion(new CellRangeAddress(// merge Number of members rowIdx, // first row (0-based) rowIdx, // last row (0-based) colIdx + 1, // first column (0-based) colIdx + dates.size() // last column (0-based) )); int colIt = colIdx + 1; for (final Date date : dates) { cell = row.createCell(colIt++); cell.setCellValue(date); cell.setCellStyle(dateCellStyle); } }
From source file:poi.xssf.usermodel.examples.CreateUserDefinedDataFormats.java
License:Apache License
public static void main(String[] args) throws Exception { Workbook wb = new XSSFWorkbook(); //or new HSSFWorkbook(); Sheet sheet = wb.createSheet("format sheet"); CellStyle style; DataFormat format = wb.createDataFormat(); Row row;/* w w w . j a v a 2 s . c o m*/ Cell cell; short rowNum = 0; short colNum = 0; row = sheet.createRow(rowNum++); cell = row.createCell(colNum); cell.setCellValue(11111.25); style = wb.createCellStyle(); style.setDataFormat(format.getFormat("0.0")); cell.setCellStyle(style); row = sheet.createRow(rowNum++); cell = row.createCell(colNum); cell.setCellValue(11111.25); style = wb.createCellStyle(); style.setDataFormat(format.getFormat("#,##0.0000")); cell.setCellStyle(style); FileOutputStream fileOut = new FileOutputStream("ooxml_dataFormat.xlsx"); wb.write(fileOut); fileOut.close(); }
From source file:ro.dabuno.office.integration.BusinessPlan.java
License:Apache License
/** * create a library of cell styles/* www.j av a 2 s. c om*/ */ private static Map<String, CellStyle> createStyles(Workbook wb) { Map<String, CellStyle> styles = new HashMap<String, CellStyle>(); DataFormat df = wb.createDataFormat(); CellStyle style; Font headerFont = wb.createFont(); headerFont.setBold(true); style = createBorderedStyle(wb); style.setAlignment(HorizontalAlignment.CENTER); style.setFillForegroundColor(IndexedColors.LIGHT_CORNFLOWER_BLUE.getIndex()); style.setFillPattern(FillPatternType.SOLID_FOREGROUND); style.setFont(headerFont); styles.put("header", style); style = createBorderedStyle(wb); style.setAlignment(HorizontalAlignment.CENTER); style.setFillForegroundColor(IndexedColors.LIGHT_CORNFLOWER_BLUE.getIndex()); style.setFillPattern(FillPatternType.SOLID_FOREGROUND); style.setFont(headerFont); style.setDataFormat(df.getFormat("d-mmm")); styles.put("header_date", style); Font font1 = wb.createFont(); font1.setBold(true); style = createBorderedStyle(wb); style.setAlignment(HorizontalAlignment.LEFT); style.setFont(font1); styles.put("cell_b", style); style = createBorderedStyle(wb); style.setAlignment(HorizontalAlignment.CENTER); style.setFont(font1); styles.put("cell_b_centered", style); style = createBorderedStyle(wb); style.setAlignment(HorizontalAlignment.RIGHT); style.setFont(font1); style.setDataFormat(df.getFormat("d-mmm")); styles.put("cell_b_date", style); style = createBorderedStyle(wb); style.setAlignment(HorizontalAlignment.RIGHT); style.setFont(font1); style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); style.setFillPattern(FillPatternType.SOLID_FOREGROUND); style.setDataFormat(df.getFormat("d-mmm")); styles.put("cell_g", style); Font font2 = wb.createFont(); font2.setColor(IndexedColors.BLUE.getIndex()); font2.setBold(true); style = createBorderedStyle(wb); style.setAlignment(HorizontalAlignment.LEFT); style.setFont(font2); styles.put("cell_bb", style); style = createBorderedStyle(wb); style.setAlignment(HorizontalAlignment.RIGHT); style.setFont(font1); style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); style.setFillPattern(FillPatternType.SOLID_FOREGROUND); style.setDataFormat(df.getFormat("d-mmm")); styles.put("cell_bg", style); Font font3 = wb.createFont(); font3.setFontHeightInPoints((short) 14); font3.setColor(IndexedColors.DARK_BLUE.getIndex()); font3.setBold(true); style = createBorderedStyle(wb); style.setAlignment(HorizontalAlignment.LEFT); style.setFont(font3); style.setWrapText(true); styles.put("cell_h", style); style = createBorderedStyle(wb); style.setAlignment(HorizontalAlignment.LEFT); style.setWrapText(true); styles.put("cell_normal", style); style = createBorderedStyle(wb); style.setAlignment(HorizontalAlignment.CENTER); style.setWrapText(true); styles.put("cell_normal_centered", style); style = createBorderedStyle(wb); style.setAlignment(HorizontalAlignment.RIGHT); style.setWrapText(true); style.setDataFormat(df.getFormat("d-mmm")); styles.put("cell_normal_date", style); style = createBorderedStyle(wb); style.setAlignment(HorizontalAlignment.LEFT); style.setIndention((short) 1); style.setWrapText(true); styles.put("cell_indented", style); style = createBorderedStyle(wb); style.setFillForegroundColor(IndexedColors.BLUE.getIndex()); style.setFillPattern(FillPatternType.SOLID_FOREGROUND); styles.put("cell_blue", style); return styles; }
From source file:ro.dabuno.office.integration.LoadCalculator.java
/** * cell styles used for formatting calendar sheets */// w ww.j a v a 2s . c o m private static Map<String, CellStyle> createStyles(Workbook wb) { Map<String, CellStyle> styles = new HashMap<String, CellStyle>(); CellStyle style; Font titleFont = wb.createFont(); titleFont.setFontHeightInPoints((short) 14); titleFont.setFontName("Trebuchet MS"); style = wb.createCellStyle(); style.setFont(titleFont); style.setBorderBottom(BorderStyle.DOTTED); style.setBottomBorderColor(IndexedColors.GREY_40_PERCENT.getIndex()); styles.put("title", style); Font itemFont = wb.createFont(); itemFont.setFontHeightInPoints((short) 9); itemFont.setFontName("Trebuchet MS"); style = wb.createCellStyle(); style.setAlignment(HorizontalAlignment.LEFT); style.setFont(itemFont); styles.put("item_left", style); style = wb.createCellStyle(); style.setAlignment(HorizontalAlignment.RIGHT); style.setFont(itemFont); styles.put("item_right", style); style = wb.createCellStyle(); style.setAlignment(HorizontalAlignment.RIGHT); style.setFont(itemFont); style.setBorderRight(BorderStyle.DOTTED); style.setRightBorderColor(IndexedColors.GREY_40_PERCENT.getIndex()); style.setBorderBottom(BorderStyle.DOTTED); style.setBottomBorderColor(IndexedColors.GREY_40_PERCENT.getIndex()); style.setBorderLeft(BorderStyle.DOTTED); style.setLeftBorderColor(IndexedColors.GREY_40_PERCENT.getIndex()); style.setBorderTop(BorderStyle.DOTTED); style.setTopBorderColor(IndexedColors.GREY_40_PERCENT.getIndex()); style.setDataFormat( wb.createDataFormat().getFormat("_($* #,##0.00_);_($* (#,##0.00);_($* \"-\"??_);_(@_)")); styles.put("input_$", style); style = wb.createCellStyle(); style.setAlignment(HorizontalAlignment.RIGHT); style.setFont(itemFont); style.setBorderRight(BorderStyle.DOTTED); style.setRightBorderColor(IndexedColors.GREY_40_PERCENT.getIndex()); style.setBorderBottom(BorderStyle.DOTTED); style.setBottomBorderColor(IndexedColors.GREY_40_PERCENT.getIndex()); style.setBorderLeft(BorderStyle.DOTTED); style.setLeftBorderColor(IndexedColors.GREY_40_PERCENT.getIndex()); style.setBorderTop(BorderStyle.DOTTED); style.setTopBorderColor(IndexedColors.GREY_40_PERCENT.getIndex()); style.setDataFormat(wb.createDataFormat().getFormat("0.000%")); styles.put("input_%", style); style = wb.createCellStyle(); style.setAlignment(HorizontalAlignment.RIGHT); style.setFont(itemFont); style.setBorderRight(BorderStyle.DOTTED); style.setRightBorderColor(IndexedColors.GREY_40_PERCENT.getIndex()); style.setBorderBottom(BorderStyle.DOTTED); style.setBottomBorderColor(IndexedColors.GREY_40_PERCENT.getIndex()); style.setBorderLeft(BorderStyle.DOTTED); style.setLeftBorderColor(IndexedColors.GREY_40_PERCENT.getIndex()); style.setBorderTop(BorderStyle.DOTTED); style.setTopBorderColor(IndexedColors.GREY_40_PERCENT.getIndex()); style.setDataFormat(wb.createDataFormat().getFormat("0")); styles.put("input_i", style); style = wb.createCellStyle(); style.setAlignment(HorizontalAlignment.CENTER); style.setFont(itemFont); style.setDataFormat(wb.createDataFormat().getFormat("m/d/yy")); styles.put("input_d", style); style = wb.createCellStyle(); style.setAlignment(HorizontalAlignment.RIGHT); style.setFont(itemFont); style.setBorderRight(BorderStyle.DOTTED); style.setRightBorderColor(IndexedColors.GREY_40_PERCENT.getIndex()); style.setBorderBottom(BorderStyle.DOTTED); style.setBottomBorderColor(IndexedColors.GREY_40_PERCENT.getIndex()); style.setBorderLeft(BorderStyle.DOTTED); style.setLeftBorderColor(IndexedColors.GREY_40_PERCENT.getIndex()); style.setBorderTop(BorderStyle.DOTTED); style.setTopBorderColor(IndexedColors.GREY_40_PERCENT.getIndex()); style.setDataFormat(wb.createDataFormat().getFormat("$##,##0.00")); style.setBorderBottom(BorderStyle.DOTTED); style.setBottomBorderColor(IndexedColors.GREY_40_PERCENT.getIndex()); style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); style.setFillPattern(FillPatternType.SOLID_FOREGROUND); styles.put("formula_$", style); style = wb.createCellStyle(); style.setAlignment(HorizontalAlignment.RIGHT); style.setFont(itemFont); style.setBorderRight(BorderStyle.DOTTED); style.setRightBorderColor(IndexedColors.GREY_40_PERCENT.getIndex()); style.setBorderBottom(BorderStyle.DOTTED); style.setBottomBorderColor(IndexedColors.GREY_40_PERCENT.getIndex()); style.setBorderLeft(BorderStyle.DOTTED); style.setLeftBorderColor(IndexedColors.GREY_40_PERCENT.getIndex()); style.setBorderTop(BorderStyle.DOTTED); style.setTopBorderColor(IndexedColors.GREY_40_PERCENT.getIndex()); style.setDataFormat(wb.createDataFormat().getFormat("0")); style.setBorderBottom(BorderStyle.DOTTED); style.setBottomBorderColor(IndexedColors.GREY_40_PERCENT.getIndex()); style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); style.setFillPattern(FillPatternType.SOLID_FOREGROUND); styles.put("formula_i", style); return styles; }
From source file:ro.ldir.report.formatter.GarbageExcelFormatter.java
License:Open Source License
public final Workbook convert(Workbook wb) { Sheet sheet = wb.createSheet("Lista Mormane gunoi"); Row row = sheet.createRow(0);/*from w w w . j ava2 s. c o m*/ int k = 0; row.createCell(k).setCellValue("ID"); k++; row.createCell(k).setCellValue("Jude\u0163"); k++; row.createCell(k).setCellValue("Comun\u04d1"); k++; row.createCell(k).setCellValue("Latitudine"); k++; row.createCell(k).setCellValue("Longitudine"); k++; row.createCell(k).setCellValue("Precizie GPS (metri)"); k++; row.createCell(k).setCellValue("Dispersat"); k++; row.createCell(k).setCellValue("Num\u04d1r saci"); k++; row.createCell(k).setCellValue("Marime TrashOut (1=mic;2=medium;3=mare)"); k++; row.createCell(k).setCellValue("Compozitie TrashOut"); k++; row.createCell(k).setCellValue("Plastic"); k++; row.createCell(k).setCellValue("Metal"); k++; row.createCell(k).setCellValue("Sticl\u04d1"); k++; row.createCell(k).setCellValue("Nereciclabil"); k++; row.createCell(k).setCellValue("Greu de transportat"); k++; row.createCell(k).setCellValue("Descriere"); k++; row.createCell(k).setCellValue("Stare"); k++; row.createCell(k).setCellValue("Zon\u04d1 cartare"); k++; row.createCell(k).setCellValue("Numele mormanului"); k++; row.createCell(k).setCellValue("Raza"); k++; row.createCell(k).setCellValue("Numar de voturi"); k++; row.createCell(k).setCellValue("Data introducerii"); k++; row.createCell(k).setCellValue("Nominalizat pentru Votare"); k++; row.createCell(k).setCellValue("Nominalizat pentru Curatare"); k++; for (int i = 0; i < garbages.size(); i++) { k = 0; row = sheet.createRow(i + 1); Garbage garbage = garbages.get(i); row.createCell(k, Cell.CELL_TYPE_NUMERIC).setCellValue(garbage.getGarbageId()); k++; row.createCell(k).setCellValue(garbage.getCounty().getName()); k++; if (garbage.getTown() != null) row.createCell(k).setCellValue(garbage.getTown().getName()); k++; row.createCell(k, Cell.CELL_TYPE_NUMERIC).setCellValue(garbage.getY()); k++; row.createCell(k, Cell.CELL_TYPE_NUMERIC).setCellValue(garbage.getX()); k++; row.createCell(k, Cell.CELL_TYPE_NUMERIC).setCellValue(garbage.getAccuracy()); k++; row.createCell(k, Cell.CELL_TYPE_BOOLEAN).setCellValue(garbage.isDispersed()); k++; row.createCell(k, Cell.CELL_TYPE_NUMERIC).setCellValue(garbage.getBagCount()); k++; row.createCell(k, Cell.CELL_TYPE_NUMERIC).setCellValue(garbage.getTrashOutSize()); k++; if (garbage.getTrashOutTypes() != null) row.createCell(k, Cell.CELL_TYPE_STRING).setCellValue(garbage.getTrashOutTypes()); k++; row.createCell(k, Cell.CELL_TYPE_NUMERIC).setCellValue(garbage.getPercentagePlastic()); k++; row.createCell(k, Cell.CELL_TYPE_NUMERIC).setCellValue(garbage.getPercentageMetal()); k++; row.createCell(k, Cell.CELL_TYPE_NUMERIC).setCellValue(garbage.getPercentageGlass()); k++; row.createCell(k, Cell.CELL_TYPE_NUMERIC).setCellValue(garbage.getPercentageWaste()); k++; row.createCell(k).setCellValue(garbage.getBigComponentsDescription()); k++; if (garbage.getDescription() != null) row.createCell(k, Cell.CELL_TYPE_STRING) .setCellValue(garbage.getDescription().replaceAll("\\r\\n|\\r|\\n", " ")); k++; if (garbage.getStatus() != null) row.createCell(k).setCellValue(garbage.getStatus().getTranslation()); k++; if (garbage.getChartedArea() != null) row.createCell(k).setCellValue(garbage.getChartedArea().getName()); k++; try { if (garbage.getName() != null) row.createCell(k).setCellValue(garbage.getName()); } catch (Exception e) { // TODO: handle exception } k++; try { row.createCell(k, Cell.CELL_TYPE_NUMERIC).setCellValue(garbage.getRadius()); } catch (Exception e1) { // TODO: handle exception } k++; try { if (garbage.getVotes() != null) row.createCell(k, Cell.CELL_TYPE_NUMERIC).setCellValue(garbage.getVoteCount()); } catch (Exception ee) { } k++; try { Cell cell; DataFormat df = wb.createDataFormat(); CellStyle cs = wb.createCellStyle(); cs.setDataFormat(df.getFormat("dd-mm-yyyy")); if (garbage.getRecordDate() != null) { cell = row.createCell(k, Cell.CELL_TYPE_STRING); cell.setCellValue(garbage.getRecordDate()); cell.setCellStyle(cs); } } catch (Exception ee) { } k++; row.createCell(k, Cell.CELL_TYPE_STRING).setCellValue(garbage.isToVote()); k++; row.createCell(k, Cell.CELL_TYPE_STRING).setCellValue(garbage.isToClean()); k++; } return wb; }
From source file:ro.ldir.report.formatter.TeamExcelFormatter.java
License:Open Source License
public final Workbook convert(Workbook wb) { Sheet sheet = wb.createSheet("Liste echipe"); Row row = sheet.createRow(0);//w ww . ja v a 2 s. c o m row.createCell(0).setCellValue("ID"); row.createCell(1).setCellValue("Email manager"); row.createCell(2).setCellValue("Nume manager"); row.createCell(3).setCellValue("Comun\u04d1 manager"); row.createCell(4).setCellValue("Jude\u0163 manager"); row.createCell(5).setCellValue("Cod acces"); row.createCell(6).setCellValue("Nume"); row.createCell(7).setCellValue("Num\u04d1r membri"); row.createCell(8).setCellValue("Multi-manager"); row.createCell(9).setCellValue("Nume organiza\u0163ie"); row.createCell(10).setCellValue("Comun\u04d1 organiza\u0163ie"); row.createCell(11).setCellValue("Jude\u0163 organiza\u0163ie"); row.createCell(12).setCellValue("Tip organiza\u0163ie"); row.createCell(13).setCellValue("Nume persoan\u04d1 de contact"); row.createCell(14).setCellValue("Email persoan\u04d1 de contact"); row.createCell(15).setCellValue("Num\u04d1r membri organiza\u0163ie"); row.createCell(16).setCellValue("Num\u04d1r GPS"); row.createCell(17).setCellValue("Transport"); row.createCell(18).setCellValue("Num\u04d1r saci"); row.createCell(19).setCellValue("Num\u04d1r m\u04d1nu\015Fi"); row.createCell(20).setCellValue("Num\u04d1r lope\u0163i"); row.createCell(21).setCellValue("Utilaje"); row.createCell(22).setCellValue("Num\u04d1r mormane alocate"); row.createCell(23).setCellValue("List\u04d1 mormane alocate"); row.createCell(24).setCellValue("Sum\u04d1 volum mormane alocate"); row.createCell(25).setCellValue("Activitati"); row.createCell(26).setCellValue("Data inregistrarii"); int i = 0; CreationHelper createHelper = wb.getCreationHelper(); for (Team team : teams) { if (team.getOrganizationMembers() == null || team.getOrganizationMembers().size() == 0) { i++; row = sheet.createRow(i); teamHeader(row, team); teamFooter(row, team); continue; } for (Organization org : team.getOrganizationMembers()) { i++; row = sheet.createRow(i); teamHeader(row, team); organization(row, org); teamFooter(row, team); } if (team.getTeamManager() != null) { StringBuffer ab = new StringBuffer(); List<User.Activity> activities = team.getTeamManager().getActivities(); if (activities != null && activities.size() > 0) { for (User.Activity activity : activities) if (activity != null) if (activity.getReportName() != null) ab.append(activity.getReportName() + ", "); else ab.append(" " + ", "); if (ab.length() > 1) row.createCell(25).setCellValue(ab.substring(0, ab.length() - 2)); else row.createCell(25).setCellValue(" "); } if (team.getTeamManager().getRecordDate() != null) { CellStyle cellStyle = wb.createCellStyle(); cellStyle.setDataFormat(createHelper.createDataFormat().getFormat("m/d/yy h:mm")); Cell dateCell = row.createCell(26); dateCell.setCellValue(team.getTeamManager().getRecordDate()); dateCell.setCellStyle(cellStyle); } } } return wb; }