Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 507
Muaddib878 Avatar asked Feb 28 '19 18:02

Muaddib878


2 Answers

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");
like image 123
Its BK Avatar answered Sep 21 '22 09:09

Its BK


If you want to create pdf/excel/word using rdlc report I recommend you can use AspNetCore.Reporting library. This is open source and comes as a nuget package. you can integrate this in your .NET Core API or .NET Core Azure function. You can generate a byte array convert it to base 64 string and retrieve that to your client side. More on the link in the comment.

like image 34
Tharindu Jayasinghe Avatar answered Sep 21 '22 09:09

Tharindu Jayasinghe