Export pentaho report to Excel 2007 format (.xlsx)
This commit is contained in:
+8
-2
@@ -248,7 +248,7 @@ public class ReadReportingServiceImpl implements ReadReportingService {
|
||||
outputType = outputTypeParam;
|
||||
}
|
||||
|
||||
if (!(outputType.equalsIgnoreCase("HTML") || outputType.equalsIgnoreCase("PDF") || outputType.equalsIgnoreCase("XLS") || outputType
|
||||
if (!(outputType.equalsIgnoreCase("HTML") || outputType.equalsIgnoreCase("PDF") || outputType.equalsIgnoreCase("XLS") || outputType.equalsIgnoreCase("XLSX") || outputType
|
||||
.equalsIgnoreCase("CSV"))) { throw new PlatformDataIntegrityException("error.msg.invalid.outputType",
|
||||
"No matching Output Type: " + outputType); }
|
||||
|
||||
@@ -279,13 +279,19 @@ public class ReadReportingServiceImpl implements ReadReportingService {
|
||||
PdfReportUtil.createPDF(masterReport, baos);
|
||||
return Response.ok().entity(baos.toByteArray()).type("application/pdf").build();
|
||||
}
|
||||
|
||||
|
||||
if ("XLS".equalsIgnoreCase(outputType)) {
|
||||
ExcelReportUtil.createXLS(masterReport, baos);
|
||||
return Response.ok().entity(baos.toByteArray()).type("application/vnd.ms-excel")
|
||||
.header("Content-Disposition", "attachment;filename=" + reportName.replaceAll(" ", "") + ".xls").build();
|
||||
}
|
||||
|
||||
if ("XLSX".equalsIgnoreCase(outputType)) {
|
||||
ExcelReportUtil.createXLSX(masterReport, baos);
|
||||
return Response.ok().entity(baos.toByteArray()).type("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
|
||||
.header("Content-Disposition", "attachment;filename=" + reportName.replaceAll(" ", "") + ".xlsx").build();
|
||||
}
|
||||
|
||||
if ("CSV".equalsIgnoreCase(outputType)) {
|
||||
CSVReportUtil.createCSV(masterReport, baos, "UTF-8");
|
||||
return Response.ok().entity(baos.toByteArray()).type("text/csv")
|
||||
|
||||
Reference in New Issue
Block a user