How to: Use the XRSubreport Control with Reports V2 Data Sources 如何:将XRSubreport控件与报表V2数据源一起使用

This topic describes the specifics of using the XRSubreport control when creating a Master-Detail Report with Data Sources for Reports V2 (CollectionDataSource or ViewDataSource).

本主题介绍在创建包含报表 V2(收集数据源或视图数据源)数据源的主详细信息报表时使用 XRSubreport 控件的详细信息。

 

Note 注意
The approach described in this topic is not supported by the Mobile platform.
移动平台不支持本主题中描述的方法。

XRSubreport and CollectionDataSource

XRSub报告和收集数据源

To create a report with a subreport in XAF, you can follow the Creating a Master-Detail Report using Subreports tutorial published in the XtraReports documentation, but using the CollectionDataSource instead of binding to data directly. Then, you can register a master report using the PredefinedReportsUpdater.AddPredefinedReport<T> method. No additional steps are required.

要在 XAF 中创建具有子报表的报表,可以使用 XtraReports 文档中发布的子报表教程,但使用收集数据源而不是直接绑定到数据,即可遵循创建主详细报告。然后,您可以使用预定义报告Update<T>r注册主报表。无需执行其他步骤。

XRSubreport and ViewDataSource

XRSub报告和视图数据源

Note 注意
The complete example is available in the FeatureCenter application. By default, this demo is installed in the %PUBLIC%\Documents\DevExpress Demos 19.2\Components\eXpressApp Framework\FeatureCenter path. The master report and its subreport are demonstrated in the following files.
  • FeatureCenter.Module\Reports\ContactReport.cs
  • FeatureCenter.Module\Reports\PhoneNumberReport.cs
完整的示例在功能中心应用程序中可用。默认情况下,此演示安装在 %PUBLIC%_文档_DevExpress 演示 19.2_组件_eXpressApp 框架_功能中心路径中。主报表及其子报表在以下文件中演示。
  • 功能中心.模块报告_联系人报告.cs
  • 功能中心.模块报告_电话号码报告.cs

 

If you choose ViewDataSource, use the same approach described in the previous paragraph, but take into account that the master object's key column is added in the Parameter Bindings Collection Editor dialog demonstrated in the XtraReports tutorial. With the ViewDataSource, you should add the key column manually to the ViewDataSource.Properties collection. The Expression value should refer to the key property of the business class specified by DataSourceBase.ObjectTypeName (e.g., to the BaseObject.Oid property). The image below demonstrates the key column added in the Reports Designer.

如果选择 ViewDataSource,请使用上一段中描述的相同方法,但要考虑到主对象的关键列是在 XtraReports 教程中演示的"参数绑定集合编辑器"对话框中添加的。使用 ViewDataSource,应手动将键列添加到 ViewDataSource.Properties 集合中。表达式值应引用由 DataSourceBase.ObjectTypeName 指定的 Business 类的键属性(例如,BaseObject.Oid 属性)。下图演示了报表设计器中添加的键列。

ReportsV2_Subreport_ViewDataSource_Oid

 

posted @ 2020-01-10 14:34  code first life  阅读(346)  评论(0编辑  收藏  举报