【问题标题】:How to make hyperlink to a specific page in jasper report?如何在碧玉报告中创建指向特定页面的超链接?
【发布时间】:2015-06-17 19:04:59
【问题描述】:

我有一个 jrxml 文件。在这个文件中,我有一列带有指向同一报告的超链接。但是当我从任何页面点击这个链接时,jasper 服务器会加载第一页。如何加载我单击链接的同一页面? 这是jrxml的例子

<?xml version="1.0" encoding="UTF-8"?>
<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="report2" language="groovy" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="a5de7f4f-53e0-43ce-a41d-cd01ab98e889">
    <property name="ireport.zoom" value="1.0"/>
    <property name="ireport.x" value="0"/>
    <property name="ireport.y" value="0"/>
    <queryString>
        <![CDATA[SELECT * from employee]]>
    </queryString>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="79" splitType="Stretch"/>
    </title>
    <pageHeader>
        <band height="35" splitType="Stretch"/>
    </pageHeader>
    <columnHeader>
        <band height="61" splitType="Stretch">
            <textField isStretchWithOverflow="true">
                <reportElement x="21" y="41" width="110" height="20" uuid="ac484988-9581-4b7e-bf5d-2585ae2a1365"/>
                <textElement textAlignment="Center">
                    <font size="12"/>
                </textElement>
                <textFieldExpression><![CDATA[($F(roll_no))]]></textFieldExpression>
            </textField>
            <image hAlign="Center" hyperlinkType="ReportExecution">
                <reportElement mode="Transparent" x="481" y="41" width="20" height="20" uuid="5a15a90d-499d-47ed-a768-4f703c6c5ed4"/>
                <imageExpression><![CDATA["/datasources/Images/check"]]></imageExpression>
                <hyperlinkParameter name="_report">
                    <hyperlinkParameterExpression><![CDATA["/root/reports/myReport"]]></hyperlinkParameterExpression>
                </hyperlinkParameter>
            </image>
            <staticText>
                <reportElement x="463" y="23" width="65" height="18" uuid="f13d3810-4106-42d8-acdc-0eeb8033cd32"/>
                <textElement textAlignment="Center">
                    <font size="12" isBold="true" isUnderline="false"/>
                </textElement>
                <text><![CDATA[Accept]]></text>
            </staticText>
            <staticText>
                <reportElement x="21" y="23" width="110" height="18" uuid="fbb887ce-fab7-4142-8de2-f7f565e1bb18"/>
                <textElement textAlignment="Center">
                    <font size="12" isBold="true"/>
                </textElement>
                <text><![CDATA[Staus]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="125" splitType="Stretch"/>
    </detail>
    <columnFooter>
        <band height="45" splitType="Stretch"/>
    </columnFooter>
    <pageFooter>
        <band height="54" splitType="Stretch"/>
    </pageFooter>
    <summary>
        <band height="42" splitType="Stretch"/>
    </summary>
</jasperReport>

【问题讨论】:

  • 添加一些代码或举例说明
  • 添加了有问题的示例 jrxml 数据

标签: java hyperlink jasper-reports jasperserver


【解决方案1】:

您需要为报表中您希望能够跳转到的点创建一个锚点,并在超链接定义中指定这些点。 无法发布示例,但如果您使用 iReport 或 Jaspersoft Studio 来编写报告,这应该足以帮助您入门。

【讨论】:

  • 我们可以为报告的一部分创建锚点,但这里我想跳转到页面。
  • 如何创建一个放置锚的页眉,使用每个页面递增的变量?
  • 我没有使用页眉。在页眉中添加带后,我尝试添加锚点,但没有找到超链接选项。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-03-25
  • 2022-01-27
相关资源
最近更新 更多