ActiveReports 14
ActiveReports 14 User Guide / Preview Reports / JavaScript / Configure JS Viewer
In This Topic
    Configure JS Viewer
    In This Topic

    The ActiveReports 14 provides JS Viewer MVC and JS Viewer MVC Core templates in Visual Studio. Use the template to obtain a pre-configured application.

    Note: JS Viewer Core templates are available only in Visual Studio 2019. Visual Studio 2013, Visual Studio 2015, and Visual Studio 2017 do not support the JS Viewer Core templates.

    Prerequisites

    The following steps describe how to use a JS Viewer MVC template in Visual Studio 2019:

    1. Open Microsoft Visual Studio 2019 and create a new ActiveReports 14 JS Viewer MVC Application project.
    2. On 'Configure your new project' page, fill-in the details such as Project name - JSViewerMVCApplication, Framework - .NET Framework 4.7.2, and select Create.

      The ActiveReports 14 JS Viewer template automatically does the following:
      • adds NuGet packages necessary for viewer
      • creates RDL report in Reports folder.
      • configures index.html
      • adds script and CSS files

      You can also download and install the JSViewer-related files and folders from NPM using the following command in the command line:

      npm install @grapecity/ar-viewer

      The viewer files/folders are downloaded in your current directory: .\node_modules\@grapecity\ar-viewer\dist

    3. Copy the report you want to preview in the 'Reports' folder. 
    4. Open index.html and provide the name of the report in viewer.openReport() method as:

      viewer.openReport("Reportname.rdlx");

    5. Modify the Startup.cs file to include the path of the report folder.
      Startup.cs
      Copy Code
        public class Startup
          {
              public static string EmbeddedReportsPrefix = "JSViewerMVCApplication2.Reports";
              public void Configuration(IAppBuilder app)
              {
                  app.UseErrorPage();
                  app.UseReporting(settings =>
                  {
                      settings.UseEmbeddedTemplates(EmbeddedReportsPrefix, Assembly.GetAssembly(GetType()));
                      settings.UseCompression = true;
                      settings.UseFileStore(new System.IO.DirectoryInfo("path to the Reports folder"));
                  });
                  RouteTable.Routes.RouteExistingFiles = true;
              }
          }
      
    6. Build and run the application.
    See Also