ASP.NET Core和Angular的RDLC本地报表查看器(> 2.0)
发布时间:2020-12-16 07:13:33 所属栏目:asp.Net 来源:网络整理
导读:有没有办法在asp.net核心网页上显示RDLC Local ReportViewer控件? 要在传统的WebForms应用程序上显示ReportViewer,以下代码可以正常工作. body form id="form1" runat="server" asp:ScriptManager ID="ScriptManager1" runat="server" /asp:ScriptManager d
有没有办法在asp.net核心网页上显示RDLC Local ReportViewer控件?
要在传统的WebForms应用程序上显示ReportViewer,以下代码可以正常工作. <body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <div style="height: 600px;"> <rsweb:ReportViewer ID="reportViewer" runat="server" Width="100%" Height="100%"></rsweb:ReportViewer> </div> </form> </body> 我已经尝试并测试了以下组件.结果如下. > ReportViewerForMvc – 适用于MVC,但与ASPNET Core不兼容. Q1.什么是最好的使用方法< rsweb:ReportViewer>在asp.net核心应用程序? 解决方法
如果问题是如何在aspnet核心项目上使用Microsoft Reportviewer,无论实现细节如何,我的解决方案是绕过实际的reportviewer控件并直接将报表呈现给PDF或Excel.
它适用于.net Core 1.1.我们使用的Nuget包是Fornax的Microsoft Report Viewer 2012 Runtime. using System.IO; using Microsoft.AspNetCore.Mvc; using Microsoft.Reporting.WebForms; namespace WebApplication3.Controllers { public class ReportController : Controller { private readonly IHostingEnvironment environment = null; public ReportController(IHostingEnvironment environment) { this.environment = environment; } public IActionResult Report() { string mimeType; string encoding; string filenameExtension; string[] streams; Warning[] warnings; var rv = new ReportViewer(); rv.ProcessingMode = ProcessingMode.Local; rv.LocalReport.ReportPath = Path.Combine(environment.ContentRootPath,"Reports","Report1.rdlc"); rv.LocalReport.Refresh(); var bytes = rv.LocalReport.Render("PDF",null,out mimeType,out encoding,out filenameExtension,out streams,out warnings); return File(bytes,mimeType); } } } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – 使用强类型对象保持控制器和视图分离
- 澄清ASP.NET生命周期事件的序列
- asp.net-mvc – 对HTTP POST请求的正确响应是什么?
- asp.net-web-api – Net Web API – 如何在Get上传递URL作为
- asp.net-mvc – 所有ASP.NET Web API控制器返回404
- asp.net-mvc – ASP.NET MVC 4在调试模式下捆绑js文件
- asp.net – 便携式区域的缺点
- asp.net-mvc-3 – 如何使用ViewBag属性从我的View中设置Jav
- asp.net – 添加新行到datatable的顶部
- entity-framework – 无法从程序集’EntityFramework加载’
推荐文章
站长推荐
- asp.net – Internet Explorer中的图像加载超时
- asp.net-mvc-4 – 将模型绑定到ASP.NET MVC4中的
- asp.net-mvc – 我应该选择云吗?
- 如何在asp.net中使用JSON和JQuery从WebMethod返回
- asp.net-mvc – IIS8中最佳的“动态IP限制设置”
- asp.net – 如何在MVC3 .net中实现DotNetOpenAut
- asp.net-mvc – 查找单元测试方向,显示部分视图的
- asp.net-core – 如何获取有关运行时.Net Core的
- asp.net – 将图像转换为流
- asp.net-mvc-3 – 使用接口作为部分视图数据注释
热点阅读