Please note that the information in this article is related to JasperReports Server v. 4.7 - 6.0.1
this solution (Scheduler, web user interface part) will not work for the recent versions
of the software (6.3.0, 6.2.1, 6.2.0).
7.x Disclaimer: These instructions were tested against 7.5.1 and worked fine with one modification noted at the end of this wiki
In this article I want to describe how to add the Plain Text exporter to the list of exporters for Report and AdHoc View.
The line that represents this exporter is commented out by default for Reports and should be added to the configuration list of exporters for AdHoc Views.
To enable Plain Text exporter for Reports please navigate to the file that I quote below and open it in your favorite editor:
<your_installation>jasperserver-proWEB-INFflowsviewReportBeans.xml
At the very bottom of this file, you will find the following section, which allows you to enable/disable exporters:
<util:map id="exporterConfigMap"> <entry key="pdf" value-ref="pdfExporterConfiguration" /> <entry key="xls" value-ref="xlsExporterConfiguration" /> <entry key="csv" value-ref="csvExporterConfiguration" /> <entry key="docx" value-ref="docxExporterConfiguration" /> <entry key="rtf" value-ref="rtfExporterConfiguration" /> <entry key="swf" value-ref="swfExporterConfiguration" /> <entry key="odt" value-ref="odtExporterConfiguration" /> <entry key="ods" value-ref="odsExporterConfiguration" /> <entry key="xlsx" value-ref="xlsxExporterConfiguration" /> <entry key="txt" value-ref="txtExporterConfiguration" /> </util:map>
And uncomment the line that I quote below to enable the Plain Text exporter:
<entry key="txt" value-ref="txtExporterConfiguration" />
To enable Plain Text exporter for AdHoc Views please navigate to the file that I quote below and open it in your favorite editor:
<your_installation>webappsjasperserver-proWEB-INFapplicationContext-adhoc.xml
At the very bottom of this file, you will find the section, which allows you to enable/disable exporters:
and add the line
<entry key="txt" value="jasper.report.view.hint.export.txt" />
to the xml snippet that I quote below:
<util:map id="exportFormatLabels"> <entry key="pdf" value="jasper.report.view.hint.export.pdf" /> <entry key="xls" value="jasper.report.view.hint.export.excel" /> <entry key="xlsNoPag" value="jasper.report.view.hint.export.excel.nopag"/> <entry key="csv" value="jasper.report.view.hint.export.csv" /> <entry key="docx" value="jasper.report.view.hint.export.docx" /> <entry key="rtf" value="jasper.report.view.hint.export.rtf" /> <entry key="swf" value="jasper.report.view.hint.export.swf" /> <entry key="odt" value="jasper.report.view.hint.export.odt" /> <entry key="ods" value="jasper.report.view.hint.export.ods" /> <entry key="xlsx" value="jasper.report.view.hint.export.xlsx" /> <entry key="xlsxNoPag" value="jasper.report.view.hint.export.xlsx.nopag" /> <entry key="txt" value="jasper.report.view.hint.export.txt" /> </util:map>
To remove unwanted exporter from the list of exporters that are available for AdHoc Views the line related
to it should be commented out from the list.
To enable Plain Text exporter in the JasperReports Server Scheduler:
navigate to
webappsjasperserver-proWEB-INFflows
open in your favorite editor the file
webappsjasperserver-proWEB-INFflowsreportJobBeans.xml
navigate to the strings 191-200 and uncomment the bean:
<bean class="com.jaspersoft.jasperserver.war.dto.ByteEnum">
<li class="leaf"> <div class="control checkBox"> <label class="wrap" for="scheduler_box_14" title="<spring:message code="report.output.txt.label.tooltip"/>">TXT</label> <input id="scheduler_box_14" name="outputFormats" value="TXT" type="checkbox"> </div> </li>
You should also make this feature available via the web user interface.
To do this
- navigate to
webappsjasperserver-proWEB-INFjspmodulesreportScheduling
- open in your favorite editor the file
webappsjasperserver-proWEB-INFjspmodulesreportSchedulingtab.output.jsp
find the section related to the exporters description and add the snippet that I quote below:
Please pay your attention to the index in the very end of the name scheduler_box_14
It should not collide with the indexes that are present in names of other exporters.
If you find that the index with the number 14 is already present, just increment it by one (15),
the resulting name should be scheduler_box_15.
Once you have commented or uncommented the exporters you want
your users to see, restart your application server. Only the uncommented exporters should be visible.
Thats all. Thank you for your attention to this article.
Instructions for introducing scheduler UI changes starting from JasperReports Server 6.4.0
Starting from JRS 6.4.0 you no longer need to edit JSP files. Instead, you should refer to JavaScript files. To make TXT export channel appear on scheduler page, you need to edit to
jasperserver-pro/scripts/bower_components/jrs-ui/src/scheduler/view/editor/outputTabView.js
Look for availableFormats array and introduce new object for TXT exporter. Your availableFormats should look similar to this one:
availableFormats: [{ name: 'csv', num: 5}, {name: 'html', num: 2}, {name: 'rtf', num: 4}, {name: 'docx', num: 8}, {name: 'ods', num: 9}, {name: 'xlsx.nopag', num: 12}, {name:'xls', num:3}, {name: 'odt', num: 6}, {name: 'xlsx', num: 10}, {name: 'xls.nopag', num: 11}, {name: 'pdf', num: 1}, {name: 'pptx', num: 14}, {name: 'txt', num: 7}]
After updating any JavaScript file you have to run JS optimization to apply this change to optimized scripts. You can also automate this process if you plan to optimize JavaScript files regularly:
Instructions for introducing scheduler UI changes starting from JasperReports Server 7.2.0+
Starting from JRS 7.2.0 (and perhaps earlier but not tested), modifiying the available formats displayed on the scheduler was made easier by pulling it out into an XML file.
To do this, open jasperserver-pro/WEB-INF/applicationContext-report-scheduling.xml and check for availableReportJobOutputFormats. Uncomment the TXT value at the end (and/or comment out other options as desired).
<!-- Comment/uncomment any of the entries below if you want related exporters to be excluded/included in the scheduler's output formats list --> <!-- * Report output formats: --> <util:list id="availableReportJobOutputFormats" value-type="java.lang.String"> <value>CSV</value> <value>HTML</value> <value>RTF</value> <value>DOCX</value> <value>ODS</value> <value>XLSX_NOPAG</value> <value>XLS</value> <value>ODT</value> <value>XLSX</value> <value>XLS_NOPAG</value> <value>PDF</value> <value>PPTX</value> <!--<value>TXT</value>--> <value>DATA_SNAPSHOT</value> <!-- This one will not appear if data snapshot persistence is turned off --> </util:list>
MJB
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now