如何在运行时更改rdlc报告中的子报告?
我创建了名为“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
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.
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论