You Can use virtualizer for this. Below is the sample. public InputStream xlsReportGen(String xml, String reportTemplate,String reportPath, Map<String, Object> reportParams)throws Exception { ByteArrayOutputStream _out = new ByteArrayOutputStream();JRDataSource datasource = new JRXmlDataSource(new File(xml));JasperReport jasperReport = (JasperReport) JRLoader.loadObjectFromFile(reportPath + reportTemplate); // creating the virtualizerJRSwapFile swapFile = new JRSwapFile(reportPath, 4096, 4096);JRAbstractLRUVirtualizer virtualizer = new JRSwapFileVirtualizer(5000,swapFile, true);reportParams.put(JRParameter.REPORT_VIRTUALIZER, virtualizer); JasperPrint _print = JasperFillManager.fillReport(jasperReport,reportParams, datasource); if (virtualizer != null) {virtualizer.cleanup();} JRXlsExporter exporter = new JRXlsExporter();exporter.setParameter(JRExporterParameter.JASPER_PRINT, _print);exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, _out);exporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,Boolean.TRUE);exporter.exportReport(); return new ByteArrayInputStream(_out.toByteArray());}