Reputation: 41
Is there a way I can convert a xml file to jrxml file?
I am doing a project where I need to write data from the database in a MS Word file that is already designed with the required template. I have converted that document file into xml format.
I am using iReport to generate the resultant doc file. But it requires a jrxml file. It fails to read from xml file.
Upvotes: 4
Views: 8549
Reputation: 1
Save your MS WORD file (Template) in report directory and using Apache POI, Do necessary edits to your template. Then save your file to any place you like.
Apache POI tutorials
Link 01:
To print save your edited file in temp directory and call Desktop.getDesktop().print(file)
using desktop
Link 02:
Wish you good luck.
Upvotes: 0
Reputation: 1584
Bijil,
JRXML is a template that contains the format for the content that is shown on the report.
And from what i understand the xml is containing the input data.
How jasper reports work is, you create JASPER file by compiling the JRXML file (this can be done using iReport or through your java code). To this JASPER file you will attach a object from your java code that contain data for filling the JASPER.
Please see this link for details
Edited: iReport
is a designer tool for creating jasper reports
, I am not sure if there any tool that can convert xml
to jrxml
. jrxml
will contain the syntax with respect to jasper report.
What we used to do, were try to create a similar report(by comparing the look and feel) as the one client has given using iReport
and get the final jrxml
.
Compile jrxml
in iReport
check the look and feel with the sample word doc with the generated sample report
Then use the compiled jasper file in the application directly. The use of jasper has 2 advantages,
disadvantage
Upvotes: 2