发布时间 : 2018-09-12 10:36:57.000|阅读 427 次
概述:本文主要讲解在Stimulsoft中如何使用各种选项将子报表添加到主报表。
相关链接:
【下载Stimulsoft Reports.Ultimate最新版本】
此示例显示如何使用各种选项将子报表添加到主报表。为此,我们需要加载所需的报表。例如,我们将收集三份报表:
private void button7_Click(object sender, System.EventArgs e)
{
    StiReport report1 = GetReport("SimpleList.mrt");
    StiReport report2 = GetReport("SimpleGroup.mrt");
    StiReport report3 = GetReport("Master-Detail.mrt");
...
然后创建一个主报表对象,并在SubReports集合中添加上面的报表。所述SubReports.Add()方法有两个布尔选项ResetPageNumber和PrintOnPreviousPage。您可以使用这些选项自定义子报表的显示:
...   
    var report = new StiReport();
    report.SubReports.Add(report1);
    report.SubReports.Add(report2, checkBoxResetPageNumber.Checked, checkBoxPrintOnPreviousPage.Checked);
    report.SubReports.Add(report3, checkBoxResetPageNumber.Checked, checkBoxPrintOnPreviousPage.Checked);
...
最后,渲染报表并在查看器中显示它:
示例代码的结果如下图所示:

购买Stimulsoft正版授权,请点击“咨询在线客服”哟!

渝ICP备12000582号-15/渝公网安备 50010702501010号