[#12966] - Html content display issues for HTML and PDF reports (textElement with makrup='html')

Bug report
Feedback Requested
Project: Severity:
Component: Reproducibility:
Assigned to:

Steps to reproduce the bug are given as follow.
1. Create a Jasper report with textElement with markup='html'. I have attached sample jrxml named "Html_N_PDF_Report.jrxml".'
2. Give the Html content as follow for the textElement with markup=’html’.
"<p>Normal</p><p><span style=\"font-weight:bold\">Bold</span> <span style=\"font-style:italic\"><span style=\"font-weight:bold\">BoldItalic</span></span></p><p><span style=\"font-style:italic\">Italic</span> <u><span style=\"font-style:italic\">ItalicUnderScore</span></u></p><p><u>UnderScore</u> <span style=\"font-weight:bold\"><u>UnderScoreBold</u></span> <span style=\"font-style:italic\"><span style=\"font-weight:bold\"><u>UnderScoreBoldItalic</u></span></span></p><p><span style=\"text-decoration:line-through\">Strikethrough</span>&nbsp; <span style=\"text-decoration:line-through\"><u><span style=\"font-style:italic\"><span style=\"font-weight:bold\">BoldItalicUnderscoreStrikethrough</span></span></u></span></p><p>Test<span style=\"font-weight:bold\"><sub>Subscript</sub></span></p><p>Test<u><span style=\"font-style:italic\"><sup>SuperScript</sup></span></u></p><ol><li>Item#1</li><li>Item#2</li></ol><ul><li>Bulllet#1</li><li>Bullet#2</li></ul><div style=\"margin-left: 40px;\">Indentation#1</div><div style=\"margin-left: 80px;\">Indentation#2</div><div>Left alinged</div><div style=\"text-align: center;\">Center aligned</div><div style=\"text-align: right;\">Right aligned</div><div>This is a text paragraph to verify that justify works fine. But there is an issue with html display.</div><div><a href=\"https://community.jaspersoft.com\" shape=\"rect\">https://community.jaspersoft.com</a></div><div><hr></hr><table border=\"1\" cellpadding=\"1\" cellspacing=\"1\" style=\"width: 500px;\"><tbody><tr><td colspan=\"1\" rowspan=\"1\">Sr. No.</td><td colspan=\"1\" rowspan=\"1\">Name</td><td colspan=\"1\" rowspan=\"1\">Age</td></tr><tr><td colspan=\"1\" rowspan=\"1\">1</td><td colspan=\"1\" rowspan=\"1\">Peter</td><td colspan=\"1\" rowspan=\"1\">20</td></tr><tr><td colspan=\"1\" rowspan=\"1\">2</td><td colspan=\"1\" rowspan=\"1\">John</td><td colspan=\"1\" rowspan=\"1\">30</td></tr></tbody></table><p>&nbsp;</p></div>"

2. Generate the report in Jasper studio. I had used Jasper Studio 6.8.0.
3. Export the report as Html.
4. Export the report as PDF.

Issues observed with Html Report. Refer "Html_Report_With_Html_Content.html"
1. It doesn't display the underline text with strikethrough. For example, BoldItalicUnderscoreStrikethrough
2. It doesn't respect indentation. For example, Indentation#1 and Indentation#2
3. It doesn't respect the centre, right and justify alignment.
4. It doesn't display the hyperlink with blue font and no underline when mouse is hovered on it.
5. It doesn't display HTML table properly. For example, Html table with Sr.No. Name and Age at the end of the report

Issues observed with PDF Report. Refer "PDF_Report_With_Html_Content.pdf"
1. It doesn't respect indentation. For example, Indentation#1 and Indentation#2
2. It doesn't respect the centre, right and justify alignment.
3. It doesn't display HTML table properly. For example, Html table with Sr.No. Name and Age at the end of the report

jasper library
BhuvaRD's picture
Joined: May 15 2020 - 1:23am
Last seen: 1 year 10 months ago



Are there any comments or workarounds? Currently the functionality for Rich Text in report data results in very poor user experience - both in terms of what can be displayed (missing elements) and how it is displayed - scaled in an element versus dynamically resizing the element.


Hi Team,

Do we've any update on this? Specifically we've checked markup tag for HTML/STYLED and have not seen any solution available for below styles for all report formats (pdf, html, xlsx etc)

1. Indentation & Alignment (LEFT | CENTER | RIGHT | JUSTIFY)
2. HTML Table with ( <TABLE> | <TD> | <TR>)

Do we've any solution available for such requirement? If not then can you please let us know if same can be supported in upcoming releases?

Regards, Sameer.

  • Status:New» Feedback Requested
  • Assigned:nobody» teodord


As you mentioned in the title of this tracker, markup=html is a feature of a textElement.
A text element can only render text, which can have variable size, color, alignment, weight, posture.
We are talking about rich text, or formatted text.

This is why HTML layout tags such as the ones about tables, divs or anything else are completely ignored.
This is the same reason HTML images do not work. Otherwise the text element should be a browser control able to display any web page.
And this is not what this feature is about.

If you want to embed HTML into the report, then you should take a look at the /demo/samples/htmlcomponent sample inside the project distribution.
But be warned, this component is made also for the purpose of showing that embedding HTML into reports is usually a dead end.
HTML is rendered as HTML only in HTML exports. In all other exports such as PDF, DOCX, and the others, the only solution is to make a screenshot of the HTML and include it as a photo, which comes with the obvious drawback that images do not cross over page breaks.

Thank you,

  • Assigned:nobody»

Rich Text content is becoming more expected in Enterprise applications. Having the ability to accurately report on this data is critical. For users creating data and then sharing it via reports it is important to have the report output align with the system data. There needs to be a more modern solution to scalable reporting of Rich text information.