Java Reference
In-Depth Information
<reportElement x="0" y="0" width="555" height="30"/>
<textFieldExpression>
<![CDATA["This is the summary section. It contains less text
so that the person reading the report can get the
gist of the report data."]]>
</textFieldExpression>
<anchorNameExpression>
<![CDATA["summary_section"]]>
</anchorNameExpression>
</textField>
</band>
</summary>
</jasperReport>
As we can see from the example, we can turn a <textField> into a hyperlink by
using the hyperlinkType attribute. In this example, we set hyperLinkType to be
LocalAnchor , which means that the hyperlink target is another area of the report
specified by an anchor expression. The <hyperlinkAnchorExpression> element
indicates what the target for the hyperlink will be. To create the target for the
anchor, we need to use the <anchorNameExpression> JRXML element. Notice, in
the example, how the contents of the <anchorNameExpression> match the contents
of <hyperLinkAnchorExpression> . This is how we link hyperlinks with the
corresponding anchor.
In addition to pointing to specific anchors in the reports, hyperlinks can point to
external resources or specific pages in the report. When a hyperlink points to an
external resource, the enclosing element ( <textField> , <image> , or <chart> )
must contain a <hyperlinkReferenceExpression> element containing a report
expression indicating the name of the external resource (usually a URL).
The following table summarizes the different types of hyperlinks supported by
JasperReports:
Hyperlink Type Description
Elements Defining Hyperlink Target
LocalAnchor Hyperlink points to an anchor
in the report, defined by the
<anchorNameExpression>
element.
<hyperlinkAnchorExpression>
LocalPage
Hyperlink points to a page in the
current report.
<hyperlinkPageExpression>
None
N/A
Used to indicate that the element
containing the hyperlinkType
attribute is not an anchor (this is
the default).
 
Search WWH ::




Custom Search