c# - 如何在C#中从 Crystal 报表中获取子报表的名称?

标签 c# crystal-reports

如何在 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/

相关文章:

c# - 更改两个相关 DateTimePickers 的值时如何防止 StackOverflow 错误?

crystal-reports - Crystal Report中的IN运算符

c# - ASP Crystal Report 报表没有表格

c# - 使用 C# 在 mongoDB 中存储具有多态值的字典

c# - log4net什么时候登录?

c# - 使用 Crystal Reports ReportDocument

mysql - 显示从站状态,其中值 = x

mysql - 如何使用 VB.net 创建自定义 CrytalReporting 模板并将文件保存为 PDF

c# - Return value using String result=Command.ExecuteScalar() result返回null时出现错误

c# - 对显式声明与成员接口(interface)的细节有点困惑