【问题标题】:Stimulsoft Report Section Control in C#C# 中的 Stimulsoft 报告部分控件
【发布时间】:2014-06-17 16:14:14
【问题描述】:

我使用 Stimulsoft Report 在我的程序(C# 程序)中制作报告。

我想从 C# 代码更改(或控制)报表中的一个部分(例如页脚区域)的可见性。

这是怎么做到的?

【问题讨论】:

    标签: c# report stimulsoft


    【解决方案1】:

    我认为您应该在报告中创建一个变量并从 C# 传递一个值。
    然后在报告中,您可以使用该变量来决定是否打印您的部分。
    例如:

                bool printFooterValue = false;
                using(StiReport rpt = new StiReport())
                {
                    rpt.Load("your_report_file.mrt);
                    rpt.Dictionary.Databases.Clear();
                    rpt.Dictionary.Databases.Add(new StiOleDbDatabase("your_database", "your_connection_string"));
                    rpt.Compile();
                    rpt.CompiledReport["printFooter"] = printFooterValue;
                    if(preview == true)
                        rpt.Show(true);
                    else
                        rpt.Print(false, 1);
                }
    

    【讨论】:

      【解决方案2】:

      您可以通过 GetComponents 获取 Footer,然后在代码中启用或禁用它。

      例如

      var myFooter = rpt.GetComponents()["FooterName"];
      myFooter.Enabled = false;
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-12-05
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多