我不太确定该怎么做。我创建了一个通用类来为我的应用程序打开报告。这些报告包含在另一个未作为嵌入式资源引用的 DLL 中。
如果我引用 DLL,我可以这样做:
Viewer.LocalReport.ReportEmbeddedResource = "SomeLibrary.ReportName.rdlc";
但是,由于我没有引用 DLL,我认为我必须通过反射获取报告。这就是我被困的地方。我真的不确定该怎么做。
最佳答案
我找到了一种通过读取 RDLC 并返回流来执行此操作的方法。
public void PrepareReport(IAppReport report)
{
Viewer.LocalReport.LoadReportDefinition(report.GetStream());
}
经过一些反射(reflection),我能够拉取该 Stream 对象。
关于c# - 报告查看器 : How to load report as an embeddedresource in another assembly using reflection?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3963038/