bharathiraja_rp
-
Posts
2 -
Joined
-
Last visited
Content Type
Forum
Downloads
Featured Visualizations
Knowledge Base
Documentation (PDF Downloads)
Blog
Documentation (Test Area)
Documentation
Dr. Jaspersoft Webinar Series
Security Advisories
Events
Profiles
Posts posted by bharathiraja_rp
-
-
Hi All,
We are using jasper report in our web application. When we export the report through code to PDF and if we print the report from the exported PDF document it is fine.
But when we export the report to Excel and then print from the exported Excel document the report gets spanned to several pages and printing is incorrect.
I am attaching the Excel file and the code am using for exporting.
Please help!!
Code: public void exportToExcel ( FacesContext facesContext, JasperPrint jasperPrint ) { try { HttpServletResponse response = ( HttpServletResponse ) FacesContext .getCurrentInstance().getExternalContext().getResponse(); response.setHeader( "Content-type", "application/xls" ); response.setHeader( "Content-disposition", "attachment; filename=Report.xls" ); JRXlsExporter xlsExporter = new JRXlsExporter(); xlsExporter.setParameter( JRXlsExporterParameter.JASPER_PRINT, jasperPrint ); xlsExporter.setParameter( JRXlsExporterParameter.OUTPUT_STREAM, response .getOutputStream() ); xlsExporter.exportReport(); } catch ( JRException exception ) { LOGGER.error( "JasperException Found::" + exception.getMessage() ); throwException( facesContext, "error.exporting.report" ); } catch ( IOException exception ) { LOGGER.error( "IOException Found::" + exception.getMessage() ); throwException( facesContext, "error.exporting.report" ); } }
Excel ouput differs from pdf output
in Products
Posted
Am also facing the same issue. Does anyone have any suggestions!!!