请选择 进入手机版 | 继续访问电脑版
 找回密码
 立即注册

QQ登录

只需一步,快速开始

Lenka.Guo 讲师达人认证 悬赏达人认证
超级版主   /  发表于:2020-1-21 09:27  /   查看:2727  /  回复:0
1.    先进行版本转换
在Visual Studio 中使用转换工具,会一键替换旧项目的dll 及Web.config文件为当前安装的版本。
2.    设置项目 .Net Framework 版本为 4.6.2
3.    安装 JSViewer 需要的Nuget包
l  在菜单栏中>>选择工具>>NuGet包管理器>>程序包管理器控制台
l  选择对应的包
n  Microsoft.Owin.Host.SystemWeb4.0.0
n  Microsoft.Owin4.0.0
4.    选中项目,添加新项à OWIN Startupclass 用于设置报表存放路径
5.    右键单击项目添加ActiveReports 必要的引用或者通过添加新项->Reporting-RDL 报表来自动生成对应dll
C:\Program Files (x86)\CommonFiles\GrapeCity\ActiveReports 13
l  GrapeCity.ActiveReports.Aspnet.Viewer.dll
6.    添加 Scripts 脚本文件 到项目中及 Web.config 文件(如果 旧项目的 Web.config文件没有改动的话,可直接覆盖)JS 代码可以从NPM 直接获取
https://www.npmjs.com/package/@grapecity/ar-viewer

7.    修改 Startup.cs  函数
//Startup.cs
using GrapeCity.ActiveReports.Aspnet.Viewer;              
publicvoid Configuration(IAppBuilder app)
{
    <...>
    app.UseReporting(settings =>
    {
        // Reporting middleware settings
        settings.UseFileStore(newDirectoryInfo("path to the reports folder"));

    });
}
8.  在html页面中输入以下代码,完成
<!DOCTYPEhtml>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
<!--Addthe references to these files to the target HTML page-->
    <link rel="stylesheet" href="https://cdn.materialdesignicons.com/2.4.85/css/materialdesignicons.min.css">
    <link rel="stylesheet"href="https://fonts.cat.net/css?family=Open+Sans:400,300,600,700"type="text/css">
    <link rel="stylesheet"href="scripts/jsViewer.min.css" type="text/css">
    <scriptsrc="scripts/jsViewer.min.js"></script>
</head>
<body>
<!--Addthe DIV element that will contain the JSViewer in the target HTML page-->
    <div class=theme-defaultid="viewerContainer">Loading Report</div>
</body>
</html>
<!--Addthe code that initializes and passes the parameters in the JSViewer instance.The code might vary depending on the technology used to develop the JSViewercomponent. The example of code for the pure javascript component:-->
<scripttype="text/javascript">
    var viewer =GrapeCity.ActiveReports.JSViewer.create({
        element: '#viewerContainer',
        reportID: 'ReportName.rdlx', // the idof the report to display
        availableExports: ['Xml', 'Pdf','Excel'],
        reportService: {}
        // other properties
    });
</script>


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x

0 个回复

您需要登录后才可以回帖 登录 | 立即注册
返回顶部