posted 17 years ago
Hi all,
I am using jasper reports for generating reports.I am trying to export in html format with in browser.I am getting report but i'm getting unnecccesary images in that page.and also i'm not able to display neccesary images also.can you help me.
Here this is my code i'm using
File reportFile = new File("E:/workspace/PrivoLock27july/resources/Sample.jasper");
JasperReport jasperReport =
(JasperReport)JRLoader.loadObject(reportFile.getPath());
JasperPrint jasperPrint =
JasperManager.fillReport(jasperReport,map,jdbcConnection);
PrintWriter printWriter=response.getWriter();
JRHtmlExporter htmlExporter=new JRHtmlExporter();
response.setContentType("text/html");
request.getSession().setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE,jasperPrint);
htmlExporter.setParameter(JRExporterParameter.JASPER_PRINT,jasperPrint);
htmlExporter.setParameter(JRExporterParameter.OUTPUT_WRITER,printWriter);
Map imagesMap=new HashMap();
request.getSession().setAttribute("IMAGES_MAP",imagesMap);
htmlExporter.setParameter(JRHtmlExporterParameter.IMAGES_MAP,imagesMap);
htmlExporter.setParameter(JRHtmlExporterParameter.IMAGES_URI,"image?image=");
htmlExporter.exportReport();
Thanks in advance.