jsanjuan Posted July 19, 2010 Share Posted July 19, 2010 Hi,I'm working on a Java application with the jasperreports library, and I want to export a report to a .doc document. It creates well the archive, but when I try to open it I get only strange characters. This is my code: JasperReport jasperReport = JasperCompileManager.compileReport("C:/Users/practicas2/Desktop/helloJasperReportXML.jrxml"); JRXmlDataSource xmlDataSource = new JRXmlDataSource("C:/Users/practicas2/Desktop/data.xml","users//user"); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(), xmlDataSource); JasperExportManager.exportReportToPdfFile(jasperPrint, "C:/Users/practicas2/Desktop/report_from_xml.pdf"); JRDocxExporter exporter = new JRDocxExporter(); File archivo = new File("C:/Users/practicas2/Desktop/report_from_xml.doc"); FileOutputStream os = new FileOutputStream(archivo); exporter.setParameter(JRDocxExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRDocxExporterParameter.CHARACTER_ENCODING, "UTF-8"); exporter.setParameter(JRDocxExporterParameter.OUTPUT_STREAM, os); exporter.exportReport(); os.close(); Anybody knows why?Thanks.Post Edited by jsanjuan at 07/19/2010 11:13 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