【问题标题】:A RDLC subreport without subreport processing event没有子报表处理事件的 RDLC 子报表
【发布时间】:2014-11-12 08:01:20
【问题描述】:

我想在我的主报表中使用子报表,但不工作或处理子报表处理事件。

由于我正在制作一个具有报表查看器控件的通用表单,因此我只需向该控件发送一个报表。包含的报告可能有也可能没有子报告。

请向我提出任何可能的方案或其他可能适合上述情况的报告控制。

查看型号代码

Microsoft.Reporting.WinForms.LocalReport report = new Microsoft.Reporting.WinForms.LocalReport();
            var reportDataSource = new Microsoft.Reporting.WinForms.ReportDataSource { Name = "AllEmployeeData", Value = EmployeeList };
            report = new Microsoft.Reporting.WinForms.LocalReport();
            report.ReportEmbeddedResource = "RDLCReport.Reports.RptEmployee.rdlc";
            report.DataSources.Add(reportDataSource);
            //This is the event which publish and subscribed in view to display report
            EventAggregator.GetEvent<ShowReport>().Publish(new Dictionary<string, object>() { { "Rpt", report } });

查看代码

 private void ShowReport(Dictionary<string, object> obj)
        {
            this.ReportViewer.Report = new RDLCPrinter((Microsoft.Reporting.WinForms.LocalReport)obj["Rpt"]);
            this.ReportViewer.SetFitToWindowMode();
        }

【问题讨论】:

  • 能具体描述一下你想要达到的目标吗?
  • 我正在 WPF(MVVM) 中制作通用视图表单。我的这个视图表单将获得一个属性报告并显示它。报告可能是单一的或子报告。您可以将报告视为通用选项。
  • 这种情况下,需要时订阅子报表处理事件?
  • 由于在 ViewModel 中完成了所有报告的创建,我不想在视图上使用 subreportprocessing 事件。你想让我把代码放在这里吗
  • 是的,请给我们一些代码

标签: c# wpf reporting rdlc objectdatasource


【解决方案1】:

存在子报表处理事件是因为子报表将包含数据,该数据与主报表中显示的数据相关。

例如:

您有 Ivoices 报告。对于每张发票,此发票中都有一个产品列表。您在子报表处理事件中获取特定发票的产品。

如果您不需要使用子报表处理事件,这意味着您可能不需要使用子报表。

【讨论】:

  • 我不想使用 subreportprocessing 事件。如果有任何可能性,我正在寻找替代方案
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2023-03-17
  • 1970-01-01
  • 1970-01-01
  • 2019-02-24
  • 1970-01-01
  • 2015-12-22
  • 1970-01-01
相关资源
最近更新 更多