本文介绍了使用HyperLink将RDLC渲染为PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将超链接添加到PDF报告(RDLC).在添加HyperLink(使用参数和数据集通过.NET生成的HyperLink)之前,该报表可以很好地呈现.

I have a requirement to add a Hyperlink to a PDF report (RDLC).The report renders fine before adding the HyperLink (generated via .NET, using parameters and datasets).

为了在代码中进行概念验证",我添加了

To make a 'proof of concept' in code I have added

ReportViewer1.LocalReport.EnableHyperlinks = True
ReportViewer1.HyperlinkTarget = "_Blank"

在RDLC中,我添加了一个文本框,添加了一个转到URL"操作,并将URL设置为" http: //www.google.com '

In the RDLC I have added a TextBox, added an Action 'Go to URL' and set the URL as 'http://www.google.com'

渲染时我得到

然后我更深入地研究错误时,innerException是

When I then have a look into the error in more depth, the innerException is

我想念什么?

推荐答案

好的,不是很理想,但是我最终以XML而不是通过VisualStudio UI来编辑RDLC并使其正常工作.

Okay, not ideal, but I ended up editing the RDLC in XML, not via the VisualStudio UI and got it working.

然后我将硬编码的URL交换为参数

I've then swapped the hardcoded URL, to a Parameter

VS一定不能设置必需的东西.我在段落"之后添加了以下内容到对象XML的根中.

VS must not be setting something required. I added the following to the Root of the Object's XML, just after 'Paragraphs'.

</Paragraphs>
<ActionInfo>
    <Actions>
        <Action>
            <Hyperlink>=Parameters!HyperlinkURL.Value</Hyperlink>
        </Action>
    </Actions>
</ActionInfo>

然后,将参数添加到"ReportParameters"下

And then, the Parameter added under 'ReportParameters'

<ReportParameters>
    <ReportParameter Name="HyperlinkURL">
        <DataType>String</DataType>
        <Nullable>true</Nullable>
        <AllowBlank>true</AllowBlank>
        <Prompt>HyperlinkURL</Prompt>
    </ReportParameter>

这篇关于使用HyperLink将RDLC渲染为PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 13:26
查看更多