如何在运行时更改rdlc报告中的子报告?

发布于 2025-01-12 22:10:47 字数 1126 浏览 4 评论 0原文

我创建了名为“ReportMain.rdlc”的主报告。在这个主报告中添加了子报告。

主要报告

在此处输入图像描述

我有很多子报表,但我只需选择一个子报表即可在主报表中显示。 所以我需要动态设置子报表路径。 例如,我有三个子报表,例如“ReportSub1.rdlc”、“ReportSub2.rdlc”和“ReportSub3.rdlc”。我通过这些代码设置了选择子报表的条件。

        If (strReport == "1") Then {
            m_LocalReport.LoadSubreportDefinition("MySubreport", File.OpenRead("Reports/ReportSub1.rdlc"))
        }else if (strReport == "2"){
            m_LocalReport.LoadSubreportDefinition("MySubreport", File.OpenRead("Reports/ReportSub2.rdlc"))
        }else if (strReport == "3"){
            m_LocalReport.LoadSubreportDefinition("MySubreport", File.OpenRead("Reports/ReportSub3.rdlc"))
        }

但我不知道如何在设计器中设置将此报表用作报表:

输入图片这里的描述

我想在运行时设置。我应该在这个框中输入什么?

(我曾经添加过所有子报表并设置隐藏或可见。这种方式是可行的。但是我有很多子报表。主报表将创建所有子报表,尽管它是隐藏的。所以渲染性能非常慢。)

I created Main report named "ReportMain.rdlc". Inside this main report added subreport.

Main Report

enter image description here

I have a lot of subreport but I need to select only one subreport for showing in a Main report.
So I need to set subreport path by dynamically.
For example, I have three subreports such as "ReportSub1.rdlc", "ReportSub2.rdlc" and "ReportSub3.rdlc". I made a condition for selecting subreport by these code.

        If (strReport == "1") Then {
            m_LocalReport.LoadSubreportDefinition("MySubreport", File.OpenRead("Reports/ReportSub1.rdlc"))
        }else if (strReport == "2"){
            m_LocalReport.LoadSubreportDefinition("MySubreport", File.OpenRead("Reports/ReportSub2.rdlc"))
        }else if (strReport == "3"){
            m_LocalReport.LoadSubreportDefinition("MySubreport", File.OpenRead("Reports/ReportSub3.rdlc"))
        }

But I don't know how to set Use this report as a report: in designer.

enter image description here

I want to set at runtime. What should I input to this box?

(I've ever added all subreport and set hide or visible. This way is work. But I have a lot of subreport. A main report will create all subreports although it was hidden. So a rendering is very slow performance.)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文