Hi all,
Currently there is a requirement to embed custom HTML code into a JASPER report and then to export it as a PDF with the HTML rendered.
The HTML is well formed and does not use all the tags.
To fufil this requirement, the JRXML i am using has this particular piece of code.
The HTML i am using is also attached.
The tags that don't get rendered are the following
1. Table related
2. italic
3. bold
4.indentation
5. Justify, align
Code: |
<detail> <band height="239" splitType="Stretch"> <textField isStretchWithOverflow="true" evaluationTime="Auto" pattern="" isBlankWhenNull="true"> <reportElement key="element-1" mode="Opaque" x="0" y="0" width="487" height="239" isPrintWhenDetailOverflows="true" forecolor="#000000" backcolor="#FFFFFF"/> <textElement textAlignment="Left" verticalAlignment="Top" rotation="None" lineSpacing="Single" markup="html"> <font fontName="Arial" size="10" isBold="false" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfFontName="Helvetica" pdfEncoding="Cp1252" isPdfEmbedded="false"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA["<html>" + "<body>" + (($F{htmlContent} != null) ? String.valueOf($F{htmlContent}) : "") + "</body>" + "</html>"]]></textFieldExpression> </textField> </band> </detail></td></tr></tbody></table> |
4 Answers:
Got the same problem.
Unfortunately, the issue at http://jasperforge.org/projects/jasperreports/tracker/bug_view_page.php?... was left unanswered as well. So no luck there.
I'm currently leaning towards implementing an XSLT stylesheet which transforms my HTML into Jasper's own styled text markup tags. Does anyone have experience in this?
IMHO, there should be a simpler way to render justified/indented HTML text fields in a PDF. Sigh.
Hi,
In a future version, we'll probably try to do something else about indenting and alignment. I have replied to that tracker you mentioned, but also pointed to this other tracker which is probably more in line with what people expect:
http://jasperforge.org/projects/jasperreports/tracker/view.php?id=4256
Unfortunately for us, the JR team, we are not going to see an end to this story because only the sky is the limit in terms of what HTML tags folks think we should support. Think of only the fact that people want CSS styling to work, so we would keep adding to this feature for years from now.
Thanks,
Teodor