ReportViewer: how to load a report as an embedded source into another assembly using reflection?

I am not sure how to do this. I created a general class for opening reports for my application. The reports are contained in another DLL, which is not referred to as an embedded resource.

If I reference the DLL, I can simply do:
Viewer.LocalReport.ReportEmbeddedResource = "SomeLibrary.ReportName.rdlc";

However, since I am not referring to the DLL, it seems to me that I should get the report through reflection. I'm stuck here. I'm really not sure how to do this.

+3
source share
1 answer

I found a way to do this by reading RDLC and returning the stream.

public void PrepareReport(IAppReport report)
{
   Viewer.LocalReport.LoadReportDefinition(report.GetStream());
}

With a little reflection, I can pull out this Stream object.

+3
source

Source: https://habr.com/ru/post/1770186/


All Articles