Search code examples
asp.net-corereporting-services.net-corerdlc

Rendering .rdlc reports with ASP .NET Core


Is it possible to render .rdlc reports with ASP.NET Core? Currently this only seems to be possible if I target the .NET Framework as opposed to .NET Core.

I don't need a report viewer I just need to render the results of an .rdlc report as a byte array.


Solution

  • In case anyone is still looking for a similar solution, I would recommend using "ReportViewerCore.NETCore".

    Here is the nuGet reference - https://www.nuget.org/packages/ReportViewerCore.NETCore/

    Here is the github link to the repo - https://github.com/lkosson/reportviewercore/

    Basic usage

    Stream reportDefinition; // your RDLC from file or resource
    IEnumerable dataSource; // your datasource for the report
    
    LocalReport report = new LocalReport();
    report.LoadReportDefinition(reportDefinition);
    report.DataSources.Add(new ReportDataSource("source", dataSource));
    report.SetParameters(new[] { new ReportParameter("Parameter1", "Parameter value") });
    byte[] pdf = report.Render("PDF");