JS Viewer communicates with the reporting service through the Web API. To implement the Web API, the GrapeCity.ActiveReports.Aspnet.Viewer.dll (.NET Framework) assembly is used.
The following steps describe how to configure a target ASP.NET backend application.
JS Viewer Web API Server
install-package Microsoft.Owin.Host.SystemWeb –Pre
Startup.cs |
Copy Code
|
---|---|
// Startup.cs using GrapeCity.ActiveReports.Aspnet.Viewer; public void Configuration(IAppBuilder app) { <...> app.UseReporting(settings => { // Reporting middleware settings settings.UseFileStore(new DirectoryInfo("path to the reports folder")); }); } |
Note: Don't forget to configure CORS if you're using a separate backend application.
JS Viewer Client Application
The following steps describe how to view reports in the JS Viewer. The steps include adding and initializing the JSViewer on a static HTML page.
Paste inside the <head></head> tags |
Copy Code
|
---|---|
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> <!--Add the 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"> <script src="scripts/jsViewer.min.js"></script> </head> <body> <!--Add the DIV element that will contain the JSViewer in the target HTML page--> <div class=theme-default id="viewerContainer">Loading Report</div> </body> </html> <!--Add the code that initializes and passes the parameters in the JSViewer instance. The code might vary depending on the technology used to develop the JSViewer component. The example of code for the pure javascript component:--> <script type="text/javascript"> var viewer = GrapeCity.ActiveReports.JSViewer.create({ element: '#viewerContainer', reportID: 'ReportName.rdlx', // the id of the report to display availableExports: ['Xml', 'Pdf', 'Excel'], reportService: {} // other properties }); </script> |