JasperReports allows us to add hyperlinks and anchors to our reports. The only report elements that can be hyperlinks or anchors are<textField>, <chart>
, and<image>
. Hyperlinks allow us to quickly navigate between report sections, a feature that is very useful when producing long reports. The following example illustrates how to add hyperlinks to our reports.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd">
<jasperReport name="HyperLinkDemoReport">
<title>
<band height="60">
<staticText>
<reportElement x="0" y="0" width="555" height="30"/>
<text>
<![
CDATA[In a rush?]]>
</text>
</staticText>
<textField hyperlinkType="LocalAnchor">...