示例#1
0
  public static void createXLSReport(
      InputStream reportFile, GridReportVO gridReportVO, String path, String fileName)
      throws JRException, IOException {
    gridReportVO.setPagination(true);
    JasperPrint jasperPrint = createJasperPrint(reportFile, gridReportVO);
    JExcelApiExporter exporter = new JExcelApiExporter();
    Map<JRExporterParameter, Object> p = new HashMap<JRExporterParameter, Object>();

    p.put(JRExporterParameter.JASPER_PRINT, jasperPrint);
    p.put(JRExporterParameter.OUTPUT_FILE_NAME, path + "/" + fileName);
    p.put(JExcelApiExporterParameter.IS_DETECT_CELL_TYPE, Boolean.TRUE);
    p.put(JExcelApiExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE);
    p.put(JExcelApiExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);

    exporter.setParameters(p);
    exporter.exportReport();
  }