public void setValuesFrom(int fromCol, final Object... values) { for (final Object value : values) { addCell(fromCol++, value); } }
public ExportCell addCell(final int col, final Object value) { return addCell(col, value, null); }
public ExportCell addCell(final int col) { return addCell(col, null, null); }
/** * Sets the columns of this row beginning with the given col no. Each value will be capitalized first. <br/> * Example: setCapitalizedValues("name", "street", "business phone") results in setValues("Name", "Street", "Business * phone") * * @param fromCol * @param values * @see StringUtils#capitalize(String) */ public void setCapitalizedValuesFrom(int fromCol, final String... values) { for (final String value : values) { addCell(fromCol++, StringUtils.capitalize(value)); } }
public ExportCell[] getCells() { if (cells == null) { cells = new ExportCell[maxCol + 1]; for (int i = 0; i <= maxCol; i++) { ExportCell cell = cellMap.get(i); if (cell == null) { cell = addCell(i); cellMap.put(i, cell); } cells[i] = cell; } } return cells; }
public void fillBean(final Object bean, final String[] propertyNames, final int startCol) { int col = startCol; for (final String property : propertyNames) { Object value; if (bean instanceof Map<?, ?>) { value = property == null ? bean : ((Map<?, ?>) bean).get(property); } else if (StringUtils.equals(property, ExportSheet.EMPTY)) { value = ""; } else { try { if (property != null) { value = BeanHelper.getNestedProperty(bean, property); } else { value = null; } } catch (final RuntimeException ex) { log.info("Can't load property " + property + " from bean " + bean + " (" + ex.getMessage() + ")"); value = "N/A"; } } // fill the value addCell(col++, value, property); } }
private void addEmployeeRow(final ExportSheet sheet, final EmployeeDO employee, final BigDecimal numberOfWorkingDays, final BigDecimal totalDuration, final MonthlyEmployeeReport report) { final PFUserDO user = getUserGroupCache().getUser(employee.getUserId()); final ExportRow row = sheet.addRow(); row.addCell(0, user.getFullname()); // Wochenstunden row.addCell(1, employee.getWeeklyWorkingHours(), "STUNDEN"); // Sollstunden: Wochenstunden * Arbeitstage / 5 Arbeitstage pro Woche BigDecimal wochenstunden = employee.getWeeklyWorkingHours(); if (wochenstunden == null) { wochenstunden = BigDecimal.ZERO; } final BigDecimal soll = wochenstunden.multiply(numberOfWorkingDays).divide(new BigDecimal(5), 2, RoundingMode.HALF_UP); row.addCell(2, soll, "STUNDEN"); // Iststunden final BigDecimal total = totalDuration.divide(new BigDecimal(3600000), 2, RoundingMode.HALF_UP); row.addCell(3, total, "STUNDEN"); // Differenz final BigDecimal differenz = total.subtract(soll); row.addCell(4, differenz, "STUNDEN"); row.addCell(5, report.getUnbookedDays().size()); row.addCell(6, report.getFormattedUnbookedDays()); }
/** * Merges cells and sets the value. * * @param numberOfRows * @param colFrom * @param colTo * @param value */ public ExportCell setMergedRegion(final int numberOfRows, final int firstCol, final int lastCol, final Object value) { final CellRangeAddress region = new CellRangeAddress(rowNum, rowNum + numberOfRows - 1, firstCol, lastCol); sheet.getPoiSheet().addMergedRegion(region); final ExportCell cell = addCell(firstCol, value); return cell; }
/** * Merges cells and sets the value. * * @param firstRow * @param lastRow * @param firstCol * @param lastCol * @param value */ public ExportCell setMergedRegion(final int firstRow, final int lastRow, final int firstCol, final int lastCol, final Object value) { final CellRangeAddress region = new CellRangeAddress(firstRow, lastRow, firstCol, lastCol); poiSheet.addMergedRegion(region); final ExportRow row = getRow(firstRow); final ExportCell cell = row.addCell(firstCol, value); return cell; }
private void addHeadRowCell(final ExportRow headRow, final ExportColumn col, final String[] colNames, final int idx) { headRow.addCell(idx, col.getTitle()); colNames[idx] = col.getName(); contentProvider.putColWidth(idx, col.getWidth()); }
provider.putFormat("STUNDEN", "0.00;[Red]-0.00"); final ExportRow employeeRow = employeeSheet.addRow(); employeeRow.addCell(0, ThreadLocalUserContext.getLocalizedString("fibu.employee")); employeeRow.addCell(1, ThreadLocalUserContext.getLocalizedString("fibu.employee.wochenstunden")); employeeRow.addCell(2, ThreadLocalUserContext.getLocalizedString("fibu.employee.sollstunden")); employeeRow.addCell(3, ThreadLocalUserContext.getLocalizedString("fibu.employee.iststunden")); employeeRow.addCell(4, ThreadLocalUserContext.getLocalizedString("fibu.common.difference")); employeeRow.addCell(5, ThreadLocalUserContext.getLocalizedString("fibu.monthlyEmployeeReport.daysCountWithoutTimesheets")); employeeRow.addCell(6, ThreadLocalUserContext.getLocalizedString("fibu.monthlyEmployeeReport.daysWithoutTimesheets")); int i = 0; for (final String title : colTitles) { headRow.addCell(i++, title);