Using custom tags in Jasper is similar to using fields. To do this, once you have created the label, all you have to do is copy the name and use it as a parameter. To display the image type resource, you have to put it between <imageExpression></imageExpression>.
In the following example, you can see how to use a tag with an image resource:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.6.0.final using JasperReports Library version 6.6.0 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="axa-soat" pageWidth="612" pageHeight="792" columnWidth="572" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="b61e5225-424a-4108-900b-a1114c933e56">
<parameter name="<tag_name>" class="java.lang.String"/>
<detail>
<band height="256">
<image>
<reportElement x="9" y="90" width="265" height="150" uuid="b27d51ca-bc73-4708-af4a-d9060e3410d1"/>
<imageExpression class="java.awt.Image"><![CDATA[$P{<tag_name>}]]></imageExpression>
</image>
</band>
</detail>
</jasperReport>
NOTE: Currently, it is not possible to use image and text type resources at the same time in Jasper, because it is necessary to know previously what type it has to be in order to be able to put the "imageExpression" or "textExpression" tags.
Comments
0 comments
Please sign in to leave a comment.