我是新的jasperreport developper
我想在网络浏览器上查看excel报告
我的代码是:
final JasperReportBuilder jasperReportBuilder = ReportManager.getBasicReport("Ofis Durum Raporları", "", "");
TextColumnBuilder < String > cityColumn = Columns.column("İl", "cityName", DynamicReports.type.stringType());
TextColumnBuilder < String > townColumn = Columns.column("Avukatlık Ofisi", "townName", DynamicReports.type.stringType());
TextColumnBuilder < String > stateColumn = Columns.column("Dosya Durumu", "fileState", DynamicReports.type.stringType());
TextColumnBuilder < Long > countColumn = Columns.column("Dosya Sayısı", "fileCount", DynamicReports.type.longType());
jasperReportBuilder.addColumn(cityColumn, townColumn, stateColumn, countColumn);
jasperReportBuilder.setDataSource(Collections.synchronizedList(stateReportsDTO));
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("Content-disposition", "inline; filename=test.xlsx");
try {
OutputStream stream = response.getOutputStream();
response.setHeader("Content-disposition", "inline; filename=test.xlsx");
JasperPrint jasperPrint = jasperReportBuilder.toJasperPrint();
JRXlsxExporter docxExporter = new JRXlsxExporter();
docxExporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
docxExporter.setParameter(JRExporterParameter.OUTPUT_STREAM, stream);
docxExporter.exportReport();
Response.ResponseBuilder responseBuilder = null;
responseBuilder = Response.ok(stream);
但是没有出现在网络浏览器上,只是下载
如果excel文件显示浏览器比我显示excel文件并且不可能我运行excel。 Java Process类以outputstream开头。进程类目标链接:stackoverflow.com/questions/3774432/starting-a-process-in-java
请帮帮我。