使用 LoadReportDefinition 时未加载子报表

Subreport not loaded when using using LoadReportDefinition

当我通过 LoadReportDefinition 方法加载 LocalReport 上的报表定义时,嵌入在报表中的子报表将不再加载。
我得到一个 rsErrorExecutingSubreport 说无法加载报表 XY 的报表定义。在英语中,错误文本可能是:

The report definition for report 'XY' has not been specified

当我通过 ReportEmbeddedResource-属性 加载主报表时,子报表工作正常。

当通过 LoadReportDefinition 加载 RDLC 时,子报表的报表定义必须通过 LoadSubreportDefinition 方法加载。

它会将子报表的名称作为字符串,将保存子报表的 Stream 作为参数。