我在ASP.NET MVC 5中有一个集成了rdlc的项目。在报表的工具栏中,有一个导出按钮和一个打印按钮。当我单击打印按钮时,它说We'll create a printer-friendly PDF version of your report.
,然后创建一个pdf。我不想直接打印PDF。
我的控制器:
var reportViewer = new ReportViewer();
reportViewer.LocalReport.ReportPath = Server.MapPath("~/Reports/Admin/Ledger/FullReport.rdlc");
reportViewer.LocalReport.DataSources.Clear();
reportViewer.LocalReport.DataSources.Add(new ReportDataSource("ReportDataSet", _ledgerService.GenerateFullReport(fromDate, toDate)));
reportViewer.LocalReport.Refresh();
reportViewer.ProcessingMode = ProcessingMode.Local;
reportViewer.AsyncRendering = false;
reportViewer.SizeToReportContent = true;
reportViewer.ZoomMode = ZoomMode.FullPage;
ViewBag.ReportViewer = reportViewer;
return View("~/Views/Admin/Ledger/GenerateFullReport.cshtml");
我的查看页面:
<body>
@Html.ReportViewer(ViewBag.ReportViewer as Microsoft.Reporting.WebForms.ReportViewer)
</body>