使用 ASP .NET Core 呈现 .rdlc 报告

Mua*_*878 11 rdlc reporting-services .net-core asp.net-core

是否可以.rdlc使用 ASP.NET Core呈现报告?目前,这似乎只有在我针对 .NET Framework 而不是 .NET Core 时才有可能。

我不需要报告查看器,我只需要将.rdlc报告的结果呈现为字节数组。

Tha*_*ghe 6

如果您想使用 rdlc 报告创建 pdf/excel/word,我建议您可以使用 AspNetCore.Reporting 库。这是开源的,作为 nuget 包提供。您可以将其集成到您的 .NET Core API 或 .NET Core Azure 函数中。您可以生成一个字节数组,将其转换为 base 64 字符串并将其检索到您的客户端。更多关于评论中的链接。

  • 我在github上创建了一个项目。你可以在这里找到链接。https://github.com/tharindubuddhi/netcorerdlc (2认同)

小智 2

如果有人仍在寻找类似的解决方案,我建议使用“ReportViewerCore.NETCore”。

这是 nuGet 参考 - https://www.nuget.org/packages/ReportViewerCore.NETCore/

这是该存储库的 github 链接 - https://github.com/lkosson/reportviewercore/

基本用法

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");
Run Code Online (Sandbox Code Playgroud)