c# - 报告查看器 : How to load report as an embeddedresource in another assembly using reflection?

标签 c# reflection embedded-resource reportviewer2008

我不太确定该怎么做。我创建了一个通用类来为我的应用程序打开报告。这些报告包含在另一个未作为嵌入式资源引用的 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/

相关文章:

performance - 设置类的私有(private)属性

python - 打印 Python 函数参数的名称和值

java - 如何从Java项目中的所有Java文件中提取所有字符串?

c# - wpf卡片布局

c# - 通过 WCF 发送图像的有效方法?

c# - 无法查看 ascx 文件中的代码隐藏

c# - 有没有办法调用通用的methodInfo?

c# - 如何使用 C# 在 Excel 中添加数据透视图?

swift - 如何设置自定义字体

java - 尝试使用 JavaFX 播放音频文件