如何在C#中获取子报告名称?
我有一个主报告和一个子报告。在我的C#代码中,我需要获取subreportName。
rptDynamicReport rpt = new rptDynamicReport(); // CrystalReport
//i need somethig like this
string reportName = "Multiple";// Where multiple is the sub report name
答案 0 :(得分:3)
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;
}
}
根据您的要求,我添加了隐藏功能,我没有对此进行测试,也没有亲自隐藏任何子报告。我认为这应该有效。我找不到任何“可见”财产或类似的东西。