ActiveReports 14 .NET Edition
ActiveReports 14 User Guide / Preview Reports / JavaScript / Configure JSViewer
In This Topic
    Configure JSViewer
    In This Topic

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

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

    Prerequisites

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

    1. Open Microsoft Visual Studio 2019 and create a new ActiveReports 14 JSViewer MVC Application project.
      Create a New project dialog
    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.
      Configure your new project dialog
      The ActiveReports 14 JSViewer 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.
      JSViewer
    See Also