Inserting a word document into jasper iReport
Posted on January 6, 2014 at 5:10pm
We have a number of japser reports, built in iReport. We have a scheduled process that automates running these and what we call a report pack is generated - which is a single PDF made up of the individual Jasper reports. The data in the reports is typically numerical and comes from a database - ie like a company quarterly accounts/maangement report. The reports can be run/rerun for a date range.
The requirement is to be able to have one or more jasper reports get data from a word document - such that it ends up in the single PDF that is currently generated. Ie like the Managing Directors commentary of the past quarter and a view of items coming up. If the last quarter report was rerun we want the last quarter commentary, and if this quarter is run then this quarter commentary.
The data needs to be sourced from the word document at time of report generation - ie not copying data from the word document into the iReport then compiling the report
Does anyone have any suggestions on how this can be accomplished so that its low maintenance and is as automated as possible? We would consider a commerical solution if the cost was agreeable.
Posted on January 11, 2014 at 5:30pm
What is the version of MS Word documents? If it's 2007 or above, you'll be able to save the document in docx format. You'll be able to use docx4j to parse the docx document.
Posted on January 8, 2014 at 8:08pm
"Try to convert the doc into excel and than use the excel as datasource in ireport.
Edit: Based on OP's comment.
You can not use a Microsoft word file as a JasperReport template. You will need to create a JRXML file for JasperReports. It is possible to use rtf or html as source for text fields but the final formating of such field is rather pure.
Your other option is to not user JasperReports and manipulate the Microsoft Word files directly using Apache Poi."
"Documents embedding is not supported in JR. You can create and concatenate documents using JR, starting from report templates. If your pdf document was created & saved starting from a jrxml file, then this jrxml file could be used again to generate either a subreport to be included in your final document, or as standalone document to be concatenated with other documents, using the batch export facility."
Hope it can help you a little.