Telerik Reporting
Posted m110
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Telerik Reporting相关的知识,希望对你有一定的参考价值。
Web.Config
<system.webServer> <handlers> <remove name="ExtensionlessUrlHandler-Integrated-4.0" /> <remove name="OPTIONSVerbHandler" /> <remove name="TRACEVerbHandler" /> <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> </handlers> </system.webServer></configuration>
WebApiConfig
Telerik.Reporting.Services.WebApi.ReportsControllerConfiguration.RegisterRoutes(config);
Controller
using System; using Telerik.Reporting; using Telerik.Reporting.Cache.File; using Telerik.Reporting.Services; using Telerik.Reporting.Services.Engine; using Telerik.Reporting.Services.WebApi; namespace Hinfo.SmartPolice.Web.Controllers { public class ReportsController : ReportsControllerBase { static ReportServiceConfiguration configurationInstance; static ReportsController() { configurationInstance = new ReportServiceConfiguration { HostAppId = "Hello", Storage = new FileStorage(), ReportResolver = new MyResolver() }; } public ReportsController() { this.ReportServiceConfiguration = configurationInstance; } public class MyResolver : IReportResolver { public ReportSource Resolve(string report) { return new TypeReportSource { TypeName = report }; } } } }
directive
app.directive("report", function () { return { restrict: ‘EA‘, transclude: ‘true‘, scope: { name: ‘=‘, para: ‘=‘, start: ‘=‘ }, template: ‘<div id="reportViewer1" style="height:900px;width:100%;overflow: hidden;"/>‘, link: function (scope, element, attrs) { scope.$watch(‘start‘, function (nv) { if (nv) { scope.start = false; if (element.attr(‘data-loadover‘)) { var reportViewer = $("#reportViewer1").data("telerik_ReportViewer"); reportViewer.reportSource({ report: "Hinfo.Project.Web." + scope.name + ", Hinfo.Project.Web", parameters: scope.para }) } else { $("#reportViewer1").telerik_ReportViewer({ serviceUrl: "/api/Reports/", templateUrl: ‘/Content/ReportViewer/templates/telerikReportViewerTemplate.html‘, reportSource: { report: "Hinfo.Project.Web." + scope.name + ", Hinfo.Project.Web", parameters: scope.para }, viewMode: telerikReportViewer.ViewModes.INTERACTIVE, scaleMode: telerikReportViewer.ScaleModes.SPECIFIC, scale: 1.0, enableAccessibility: false, ready: function () { element.attr(‘data-loadover‘, true); }, }); } } }); } } })
Js
$scope.start = true; $scope.name = "ProjectRpt"; $scope.para = { StartTime: $scope.rpt.StartTime, EndTime: $scope.rpt.EndTime };
html
<report name="name" para="para" start="start"></report>
以上是关于Telerik Reporting的主要内容,如果未能解决你的问题,请参考以下文章
Telerik Reporting - 使用 SqlDataSource 时无法在 Chrome 中导出
如何在Telerik Reporting CORS REST服务中启用SSL
类型 System.ComponentModel.ISite 的成员 Telerik.Reporting.ReportItemBase.Site 是接口,因此无法将其序