I'm not really sure how to go about this. I created a generic class to open reports up for my application. The reports are contained in another DLL that is not referenced as an embedded resource though.
If I reference the DLL I can just do:Viewer.LocalReport.ReportEmbeddedResource = "SomeLibrary.ReportName.rdlc";
However, since I'm not referencing the DLL I figure I have to get the report via reflection. This is where I'm stuck. I'm really not sure how to go about this.
I found a way to do this by reading the RDLC and returning the Stream.
public void PrepareReport(IAppReport report)
{
Viewer.LocalReport.LoadReportDefinition(report.GetStream());
}
With a bit of reflection I am able to pull that Stream object.
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
Stream streamReport = assembly.GetManifestResourceStream("MyProjectOrAssemblyName.Reports.Report1.rdlc");
reportView1.ProcessingMode = ProcessingMode.Local;
reportView1.LocalReport.LoadReportDefinition(streamReport);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With