如何将带条形图的jasper报告导出到html文件

时间:2012-02-02 12:15:00

标签: jasper-reports

此问题仅供参考generated jasper report is not showing bar chart

我将带有条形图(模板report5.jrxml)的jasper报告中构建的报告导出到html文件。

代码:

    public showReport() throws JRException{

                    ... 
                    InputStream reportStream = this.getClass().getResourceAsStream("/report5.jrxml");                

                    JRDataSource dataSource = new JRBeanCollectionDataSource(reportData);

                    HashMap params = new HashMap();
                    params.put("Title", "Report");

                    JasperDesign jd = JRXmlLoader.load(reportStream);


                    JasperReport jr = JasperCompileManager.compileReport(jd);

                    JasperPrint jp = JasperFillManager.fillReport(jr, params, dataSource);

                    JRHtmlExporter exporter = new JRHtmlExporter();

                    exporter.setParameter(JRExporterParameter.JASPER_PRINT, jp);

                    //EXPORTING REPORT TO A FILE "myreport.html"
                    exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, "E:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/mywebapp/WEB-INF/jsps/reports/reportsOutput/myreport.html"); 

                    exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, false);
exporter.setParameter(JRHtmlExporterParameter.IMAGES_DIR_NAME , "E:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/mywebapp/WEB-INF/jsps/reports/reportsOutput/myreport.html_files");                    exporter.setParameter(JRHtmlExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, true);

                    exporter.exportReport();


            }

输出html文件(myreport.html)中生成的报告显示文本但不显示任何图表。尽管jasper报告API生成的文件夹(myreport.html_files)包含图表图像的输出文件旁边。

为什么生成的html没有显示任何图表图像?

0 个答案:

没有答案