Inserting a word document into jasper iReport


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.



Andy.Robertson's picture
Joined: Jan 6 2014 - 5:02pm
Last seen: 12 months 4 days ago

Hi, If we are able to docx word document as a source in by using docx4j to parse.

Is that posiable if word document content image, table and text ?

If yes, can you please guide me how to do by using docx4j .



pratapkumar.martha - 4 years 10 months ago

2 Answers:


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.

hozawa's picture
Joined: Apr 24 2010 - 4:31pm
Last seen: 1 year 3 months ago

"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.

aprilevans587's picture
Joined: Apr 8 2013 - 8:40pm
Last seen: 6 years 6 months ago