【问题标题】:Render RDLC as a PDF, with a HyperLink使用超链接将 RDLC 渲染为 PDF
【发布时间】:2019-03-22 18:08:41
【问题描述】:
我需要向 PDF 报告 (RDLC) 添加超链接。
在添加超链接(通过 .NET,使用参数和数据集生成)之前,报表呈现良好。
为了在我添加的代码中进行“概念证明”
ReportViewer1.LocalReport.EnableHyperlinks = True
ReportViewer1.HyperlinkTarget = "_Blank"
在 RDLC 中,我添加了一个文本框,添加了一个操作“转到 URL”并将 URL 设置为“http://www.google.com”
渲染时我得到
本地报告处理过程中发生错误
当我更深入地查看错误时,innerException 是
尚未指定运行报告所需的一个或多个参数。
我错过了什么?
【问题讨论】:
标签:
.net
pdf
hyperlink
rdlc
reportviewer
【解决方案1】:
好的,不理想,但我最终用 XML 编辑 RDLC,而不是通过 VisualStudio UI 并让它工作。
然后我将硬编码的 URL 换成了一个参数
VS 不得设置所需的内容。我将以下内容添加到对象 XML 的根中,就在“段落”之后。
</Paragraphs>
<ActionInfo>
<Actions>
<Action>
<Hyperlink>=Parameters!HyperlinkURL.Value</Hyperlink>
</Action>
</Actions>
</ActionInfo>
然后,在'ReportParameters'下添加的参数
<ReportParameters>
<ReportParameter Name="HyperlinkURL">
<DataType>String</DataType>
<Nullable>true</Nullable>
<AllowBlank>true</AllowBlank>
<Prompt>HyperlinkURL</Prompt>
</ReportParameter>