Migrate Report Viewer application
In our Bold Reports® new assemblies are introduced for both client and server-side to resolve the compatibility problem between Essential Studio Report Viewer versions. It has changes in both Web API service and client-side scripts.
This section provides step-by-step instructions for migrating Report Viewer from Syncfusion® Essential Studio release version to Bold Reports® version of JavaScript Report Viewer application:
Client-side migration
To refer the latest scripts and CSS references of Report Viewer do the following steps,
-
Remove the following scripts and CSS references from the Report Viewer page.
ej.web.all.min.cssej.web.all.min.js
-
Replace the following scripts and CSS references in the <head> tag of the Report Viewer page.
<link href="Content/bold-reports/v2.0/tailwind-light/bold.report-viewer.min.css" rel="stylesheet" /> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" type="text/javascript"></script> <!-- Report Viewer component script--> <script src="Scripts/bold-reports/v2.0/common/bold.reports.common.min.js"></script> <script src="Scripts/bold-reports/v2.0/common/bold.reports.widgets.min.js"></script> <script src="Scripts/bold-reports/v2.0/bold.report-viewer.min.js"></script>
Adding data visualization scripts
To render the report with data visualization components such as chart, gauge, and map items, add scripts of the visualization element. The following table shows the script reference that needs to be added in Report Viewer page for data visualization elements.
| Visualization item | Script file |
|---|---|
| Gauge, Map, Chart | bold.reports.common.min.js |
Server-side migration
- In the Solution Explorer, right-click the References and remove the
Syncfusion.EJ.ReportViewerassembly reference. - Add the assembly from the Bold Reporting NuGet package
BoldReports.Web. To add from NuGet, right-click the project or solution in the Solution Explorer tab, and choose Manage NuGet Packages. Search forBoldReports.WebNuGet package, and then install in your application.
Refer to the NuGet Packages section to learn more details about installing and configuring Report Viewer NuGet packages.
Web API Controller
-
The
IReportControllerinterface is moved toBoldReports.Web.ReportViewer. Open the Report Viewer Web API Controller file and remove the following using statement.using Syncfusion.EJ.ReportViewer; -
Add the following using statement.
using BoldReports.Web.ReportViewer;
Your application is successfully upgraded to the latest version of Report Viewer, and you can run the application with new assemblies.
Report export configuration
Now, the BoldReports.Web can export the reports with data visualization components only using web components. It is mandatory to configure the web scripts in Report Viewer Web API controller for exporting data visualization components such as chart, gauge, and map that are used in report definition. To configure the scripts in Web API, refer to the following steps:
-
Open the Report Viewer Web API controller.
-
Configure the following scripts and styles in
OnInitReportOptionson Web API controller:jquery.min.jsbold.reports.common.min.jsbold.reports.widgets.min.jsbold.report-viewer.min.js
-
Replace the following codes in Report Viewer Web API controller.
[NonAction] public void OnInitReportOptions(ReportViewerOptions reportOption) { var resourcesPath = System.Web.Hosting.HostingEnvironment.MapPath("~/Scripts"); reportOption.ReportModel.ExportResources.Scripts = new List<string> { resourcesPath + @"\bold-reports\v2.0\common\bold.reports.common.min.js", resourcesPath + @"\bold-reports\v2.0\common\bold.reports.widgets.min.js", //Report Viewer Component Script resourcesPath + @"\bold-reports\v2.0\bold.report-viewer.min.js" }; reportOption.ReportModel.ExportResources.DependentScripts = new List<string> { "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" }; }The data visulization components will not export without the above script configurations.