code: public void generateXls(OutputStream out, List<Map<String, Object>> rows, List<ColumnDef> columns) {
          try {
              Workbook wb = new HSSFWorkbook();  // or new XSSFWorkbook();
              String safeName = WorkbookUtil.createSafeSheetName("Report"); // returns " O'Brien's sales   "
              Sheet reportSheet = wb.createSheet(safeName);
  
              short rowc = 0;
              Row nrow = reportSheet.createRow(rowc++);
              short cellc = 0;
              if (rows == null) return;
              if (columns == null && rows.size() > 0)
              {
                  columns = new ArrayList<ColumnDef>(CollectionUtils.collect(rows.get(0).keySet(), new Transformer() {
                      @Override
                      public Object transform(final Object input) {
                          return new ColumnDef()
                          {{
                                  setName((String)input);
                              }};
                      }
                  }));
              }
              if (columns != null)
              {
                  for (ColumnDef column : columns)
                  {
                      Cell cell = nrow.createCell(cellc++);
                      cell.setCellValue(column.getName());
                  }
              }
              for (Map<String, Object> row : rows)
              {
                  nrow = reportSheet.createRow(rowc++);
                  cellc = 0;
                  for (ColumnDef column : columns)
                  {
                      Cell cell = nrow.createCell(cellc++);
                      cell.setCellValue(String.valueOf(row.get(column.getName())));
                  }
              }
              wb.write(out);
          } catch (IOException e) {
              e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
          }
  
      }
docs: Takes the output and transforms it into a Excel file.
  @param out Output stream.
  @param rows Rows of data from reporting-core
  @param columns Columns to list on report