gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-30 16:32:35 25 4
gpt4 key购买 nike

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

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com