From: Patrick Schmitz Date: Thu, 31 Jan 2013 23:01:10 +0000 (-0800) Subject: CSPACE-5846 Added support to generate reports in MSWord/OpenOffice docx, MSExcel... X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=b414c7c6e162e17bd1afb40a254d09b008302383;p=tmp%2Fjakarta-migration.git CSPACE-5846 Added support to generate reports in MSWord/OpenOffice docx, MSExcel/OO Xlsx, and MSPowerPoint/OO pptx formats. Tweaked the default acquisition report to fix a layering issue that precluded logo image showing up in word and excel outputs. Tested all through services and UI, but no automated testing added. Also added a small tweak to catch unknown mime types, and revert to PDF as a default, with errors in log (but no exception). Deleting the .jasper resource, as we now only want to maintain and install the jrxml. --- diff --git a/services/report/3rdparty/jasper-cs-report/src/main/resources/acq_basic.jasper b/services/report/3rdparty/jasper-cs-report/src/main/resources/acq_basic.jasper deleted file mode 100644 index f73c73c51..000000000 Binary files a/services/report/3rdparty/jasper-cs-report/src/main/resources/acq_basic.jasper and /dev/null differ diff --git a/services/report/3rdparty/jasper-cs-report/src/main/resources/acq_basic.jrxml b/services/report/3rdparty/jasper-cs-report/src/main/resources/acq_basic.jrxml index e6e705583..83109e96b 100644 --- a/services/report/3rdparty/jasper-cs-report/src/main/resources/acq_basic.jrxml +++ b/services/report/3rdparty/jasper-cs-report/src/main/resources/acq_basic.jrxml @@ -58,6 +58,9 @@ $P!{where_clause}]]> <band height="102" splitType="Stretch"> + <frame> + <reportElement mode="Opaque" x="0" y="76" width="802" height="14" forecolor="#000000" backcolor="#66FFFF"/> + </frame> <frame> <reportElement mode="Opaque" x="0" y="0" width="797" height="90" backcolor="#FFFFFF"/> <staticText> @@ -72,9 +75,6 @@ $P!{where_clause}]]> <imageExpression><![CDATA["http://www.collectionspace.org/sites/all/themes/CStheme/images/CSpaceLogo.png"]]></imageExpression> </image> </frame> - <frame> - <reportElement mode="Opaque" x="0" y="76" width="802" height="14" forecolor="#000000" backcolor="#66FFFF"/> - </frame> </band> diff --git a/services/report/client/src/main/java/org/collectionspace/services/client/ReportClient.java b/services/report/client/src/main/java/org/collectionspace/services/client/ReportClient.java index 82d40bac5..2c0b81184 100644 --- a/services/report/client/src/main/java/org/collectionspace/services/client/ReportClient.java +++ b/services/report/client/src/main/java/org/collectionspace/services/client/ReportClient.java @@ -43,6 +43,12 @@ public class ReportClient extends AbstractCommonListPoxServiceClientImpl { exporter = new JRCsvExporter(); exporter.setParameter(JRCsvExporterParameter.FIELD_DELIMITER, "\t"); outputFilename = outputFilename+".csv"; + } else if(outputMimeType.equals(ReportClient.MSWORD_MIME_TYPE) // Understand msword as docx + || outputMimeType.equals(ReportClient.OPEN_DOCX_MIME_TYPE)) { + exporter = new JRDocxExporter(); + outputFilename = outputFilename+".docx"; + } else if(outputMimeType.equals(ReportClient.MSEXCEL_MIME_TYPE) // Understand msexcel as xlsx + || outputMimeType.equals(ReportClient.OPEN_XLSX_MIME_TYPE)) { + exporter = new JRXlsxExporter(); + outputFilename = outputFilename+".xlsx"; + } else if(outputMimeType.equals(ReportClient.MSPPT_MIME_TYPE) // Understand msppt as xlsx + || outputMimeType.equals(ReportClient.OPEN_PPTX_MIME_TYPE)) { + exporter = new JRPptxExporter(); + outputFilename = outputFilename+".pptx"; + } else { + logger.error("Reporting: unsupported output MIME type - defaulting to PDF"); + exporter = new JRPdfExporter(); + outputFilename = outputFilename+"-default-to.pdf"; } // fill the report JasperPrint jasperPrint = JasperFillManager.fillReport(fileStream, params,conn);