Search code examples
htmljasper-reportsjasperserver

How to enable export to HTML format at JasperReports Server


I need to export a report in HTML format with JasperReports Server. JasperReport Server provides options to export to several formats (pdf, xls, csv, docx, rtf, odt, ...) but HTML is not included.

Exporter oprtions

Export to HTML format is available in iReport preview, but not in the JR Server when I load a jrxml file.

What do I need to do or change to make the HTML export option available?


Solution

  • There is no such option in JasperReports Server (I've checked the 6.2.0 and 5.5 versions).

    You can check the viewReportBeans.xml configuration file placed in WEB-INF\flows folder.

    It contains this block:

    <util:map id="exporterConfigMap">
        <!-- comment/uncomment any of the lines below if you want related exporters 
             to be excluded/included in the viewer's exporters list
             Note: separate configuration for iPad 'exportersSupportedByiPad'
             -->
    
        <entry key="pdf" value-ref="pdfExporterConfiguration"/>
        <entry key="xls" value-ref="xlsExporterConfiguration"/>
        <entry key="xlsNoPag" value-ref="xlsNoPaginationExporterConfiguration"/>
        <entry key="csv" value-ref="csvExporterConfiguration"/>
        <entry key="docx" value-ref="docxExporterConfiguration"/>
        <entry key="rtf" value-ref="rtfExporterConfiguration"/>
        <entry key="odt" value-ref="odtExporterConfiguration"/>
        <entry key="ods" value-ref="odsExporterConfiguration"/>
        <entry key="xlsx" value-ref="xlsxExporterConfiguration"/>
        <entry key="xlsxNoPag" value-ref="xlsxNoPaginationExporterConfiguration"/>
        <entry key="pptx" value-ref="pptxExporterConfiguration"/>
        <!-- 
        <entry key="txt" value-ref="txtExporterConfiguration"/>
        -->
    </util:map>
    

    You can disable some exporters here. But if you want to add the new one (html in your case) - you should change the source code of JR Server to add support of this format.

    You can face some difficulties during implementation of html exporter for JRS. For example, how to handle images (external resource) in report.