java - How to generate, export to word docx file? -


i trying generate docx in jasper report. have code:

jrdocxexporter exporter = new jrdocxexporter(); bytearrayoutputstream baos = new bytearrayoutputstream();     exporter.setparameter(jrexporterparameter.jasper_print, jasperprint); exporter.setparameter(jrexporterparameter.output_stream, baos); exporter.exportreport();  

how write report out file? of examples have seen around using servlets.

add parameter jrexporterparameter.output_file_name specify file , remove parameter jrexporterparameter.output_stream.

jrdocxexporter exporter = new jrdocxexporter(); exporter.setparameter(jrexporterparameter.jasper_print, jasperprint); exporter.setparameter(jrexporterparameter.output_file_name, "myreport.docx"); exporter.exportreport(); 

Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -