Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML Tag Table into Text Field - JasperReport

I have a parameter input to Text Field with html markup language or styled. But when I put tag , It doesn't show at all.

Jaspersoft supported thid Tags:

<b/>, <u/>, <i/>, <font/>,<sup/>, <sub/>, <li/>, <br/>

Is there any way to show table from that html tag ? If it can not, is there any alternative solution ?

like image 741
43ndr1k Avatar asked Apr 19 '16 13:04

43ndr1k


1 Answers

There is no way to show html table's inside a textField.

The html attribute can only be used for how characters looks, not to generate layout

The only option you have is to use the jasper report HtmlComponent <hc:html/>

Example

<componentElement>
    <reportElement x="0" y="100" width="230" height="110" backcolor="#ADD8E6" uuid="332dd551-e8cd-4cb0-a11f-7325f481017b"/>
    <hc:html xmlns:hc="http://jasperreports.sourceforge.net/htmlcomponent" xsi:schemaLocation="http://jasperreports.sourceforge.net/htmlcomponent http://jasperreports.sourceforge.net/xsd/htmlcomponent.xsd" scaleType="FillFrame" horizontalAlign="Left" verticalAlign="Top">
        <hc:htmlContentExpression><![CDATA["<table><tr><td>Hello</td></tr><tr><td>World</td></tr></table>]]></hc:htmlContentExpression>
    </hc:html>
</componentElement>

The major problem with this component is that it creates an image of your html and you will have problem scaling text.

like image 69
Petter Friberg Avatar answered Nov 11 '22 06:11

Petter Friberg