This week's book giveaway is in the Other Open Source APIs forum.
We're giving away four copies of Storm Applied and have Sean Allen, Peter Pathirana & Matthew Jankowski on-line!
See this thread for details.
The moose likes Other JSE/JEE APIs and the fly likes How to export an iReport report into an E-mail body? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Storm Applied this week in the Other Open Source APIs forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "How to export an iReport report into an E-mail body?" Watch "How to export an iReport report into an E-mail body?" New topic

How to export an iReport report into an E-mail body?

Daniel Seabra

Joined: Sep 27, 2013
Posts: 2

I have an application that generates an iReport report (it's an ordering system), which allows me to automatically send an order via E-mail body for the client.

I've created a new order body using iReport, exporting via XHTML format. The java application generates the string with the HTML tags perfectly (I've confirmed it debuging it and exporting it into a separate HTML file where I've opened into a browser), but when I try to send those HTML tags to the E-mail client (Outlook in the case), it opens those tags but with lots of missing commands, which makes the Order with lots of elements missing as tables, and formating tags stuff.

Anybody knows how to send HTML tags to an E-mail body without those issues?

Thanks for the attention!

I love fried bacon, because bacon is life.
Daniel Seabra

Joined: Sep 27, 2013
Posts: 2


Actually I've discovered a few things.

The main issue is that iReport generates <SPAN> tags to create the page body, and Outlook and many others Email clients doesn't understand those tags, so I've changed the XHTML format to HTML, that made iReport to generate better HTML coding, using <TABLE> tags to manipulate the element positions instead of <SPAN> ones, which is more pure HTML where Outlook understands. This change made Outlook to generate a better HTML body, but I got another issue.

By pattern, iReport uses blank images to align the elements in the report, and I need to avoid this images and uses only HTML tags to create the tables structure. I've found an option at iReport that fix this that is in "Tools > Options > HTML/XHTML > Other > Use images to align". I've disselected this option, and solved that question, BUT when I copy the JRXML file to the System Project, to generate this report at the Order page, that is where the system client will generate this report, the report stills generating the report using the blank images to align the elements.

Anyboy knows how can I solve this?

I don't know exactly how the report system works, but after debuging it, I've discovered that it uses those classes:


Please, could anybody help me please?
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42955
This isn't the answer you're looking for, but IMO you'd be much better off generating a PDF (which JasperReports will create just as happily) and then attaching that to an email. Getting HTML to display in all email clients is a hassle, and then you'll still need to deal with people who simply refuse to accept HTML in emails. PDFs avoid all that.
I agree. Here's the link:
subject: How to export an iReport report into an E-mail body?