如何在 C# 中获取子报表名称?
我有一份主报告和一份子报告。在我的 C# 代码中,我需要获取子报告名称。
rptDynamicReport rpt = new rptDynamicReport(); // CrystalReport
//i need somethig like this
string reportName = "Multiple";// Where multiple is the sub report name
最佳答案
using CrystalDecisions.CrystalReports.Engine;
//snip
//Where report is the parent rpt of type ReportDocument (or a subclass of ReportDocument)
foreach(ReportDocument subreport in rpt.Subreports)
{
if(subreport.Name = "Multiple")
{
//Not the most elegant solution, but should work
SubreportObject subrpt = (SubreportObject)subreport;
subrpt.Height = 0;
}
}
根据您的要求,我添加了隐藏功能,我还没有对此进行测试,也没有亲自对子报表进行任何隐藏。我认为这应该有效。我找不到任何“可见”属性或类似的东西。
关于c# - 如何在C#中从 Crystal 报表中获取子报表的名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/834610/