6sic6 Posted January 18, 2007 Share Posted January 18, 2007 Hello I've a collection List<MyBean>MyBean contains all String-int fieldFor each MyBean field I want to print its fields comma separated in a CSV file. I've done something like that Code:JasperDesign jasperDesign = JRXmlLoader.load(this.getServlet().getServletContext().getRealPath("reports/reportCsv.jrxml"«»)); JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign); //JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, new JRBeanCollectionDataSource(listMediaBean)); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, new JRBeanCollectionDataSource(collection)); JRCsvExporter csvExporter = new JRCsvExporter(); csvExporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); response.setContentType("text/csv"«»); csvExporter.setParameter(JRHtmlExporterParameter.OUTPUT_STREAM, response.getOutputStream()); csvExporter.setParameter(JRExporterParameter.CHARACTER_ENCODING, "ISO8859_1"«»); csvExporter.setParameter(JRCsvExporterParameter.FIELD_DELIMITER, ","«»); csvExporter.exportReport(); in the detail section of my reportCsv.jrxml I've put all the fields of MyBeanfields are many and long, and if I order in VERTICAL the csv print the values in vertical (looks like different object) and not in orizzontal and comma separated someone can help me to solve this problem?that code doesn't work,maybe there's a way to don't create an jrxml and say jasper to print all my fields without specify any jasperPrint? thanks a lotmartina Link to comment Share on other sites More sharing options...
Recommended Posts
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