Report Designer is a web-based WYSIWYG reporting tool for creating and editing RDLC and RDL reports. Report Designer has a wide range of report items to transform data into meaningful information and quickly build business reports.
With the Bold Reports platform, you can easily embed reporting components in your project to view and export pixel-perfect paginated reports.
In this blog post, I am going to discuss:
- How to create an ASP.NET Core app
- Steps to install the NuGet packages
- Reference scripts and CSS
- Configure script manager
- Enable tag helper
- Initialize the Report Designer
- Configure the Web API
- Add routing information
- Action parameter
- Set the Report Designer service URL
- Run the application
To get started with an ASP.NET Core application, ensure the following software is installed on your machine:
- .NET Core SDK 3.1+
- Visual Studio 2019+
Open Visual Studio and choose ASP.NET Core Web App. Provide the application name and then click Next.
Choose the ASP.NET Core version and click Create. Do not select Enable Docker.
You can refer to this FAQ if you need to use Bold Reports with ASP.NET Core on Linux or macOS.
- In the Tools menu, click NuGet Package Manager | Manage NuGet Packages for Solution. Alternatively, right-click the project/solution in the Solution Explorer tab and choose Manage NuGet Packages.
- By default, the NuGet.org package is selected in the package source dropdown. Select the package source, search for the package “BoldReports.AspNet.Core,” and then click Install. The following table provides details about the packages and their usage.
|BoldReports.Net.Core||Contains helper methods to create a Web API service to process the reports.|
|BoldReports.AspNet.Core||Contains tag helpers to create client-side reporting control.|
Refer to the NuGet package documentation to learn more details about installing and configuring Report Designer NuGet packages.
The following table provides details about the dependent packages and their purposes.
|Syncfusion.Compression.Net.Core||Support for exporting a report to PDF, Microsoft Word, and Microsoft Excel formats. It is a base library for the packages Syncfusion.Pdf.Net.Core, Syncfusion.DocIO.Net.Core, and Syncfusion.XlsIO.Net.Core.|
|Syncfusion.Pdf.Net.Core||Support for exporting a report to a PDF.|
|Syncfusion.DocIO.Net.Core||Support for exporting a report to a Word.|
|Syncfusion.XlsIO.Net.Core||A base library of the Syncfusion.XlsIO.Net.Core package.|
|Newtonsoft.Json||Serialize and deserialize the data or report for web Report Designer. It is a mandatory package for the web Report Designer, and the package version should be higher than 10.0.1 for .NET Core 2.0 and others should be higher than 9.0.1.|
|System.Data.SqlClient||This is an optional package for the Report Viewer and Designer. It should be referenced in the project when processing an RDL report and contains the SQL Server and SQL Azure data source. Also, the package version should be higher than 4.1.0.|
Directly reference the scripts and style sheets required to render the Report Designer from CDN links. Open the \Views\Shared\_Layout.cshtml page and reference the scripts and styles as shown in the following example code.
Refer to the dependencies documentation to learn more about the Report Designer’s dependent scripts and style sheets links. To learn more about rendering a report with data visualization report items, refer to the how to render data visualization report items section.
Open the ~/Views/Shared/_Layout.cshtml page and add the script manager at the end of the <body> element as in the following code sample.
<! -- Bold Reporting ScriptManager -->
It is necessary to define the following tag helper within the _ViewImports.cshtml page to initialize the Report Designer component with the tag helper support.
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, BoldReports.AspNet.Core
Initialize the Report Designer as shown in the following code sample in any webpage (cshtml) of your application in the ~/Views folder. For an example, the Index.cshtml page can be replaced with the following code.
<div style="height: 500px;width: 100%;">
The IReportDesignerController interface contains the required actions and helper methods declaration to process the designer file and data actions.
The class ReportDesignerHelper contains helper methods that process Post or Get requests from the Report Designer control and return the responses to the control. It has the following methods.
|GetResource||Returns the report resource for the requested key.|
|ProcessReport||Processes the report request and returns the result.|
The ReportHelper class contains helper methods that process Post or Get requests for report preview actions and return the response to the Report Designer.
Routing is the process of directing an HTTP request to a controller. The functionality of this processing is implemented in System.Web.Routing.
An action parameter names the action method on the controller. It is used to map the method in the controller.
To browse, open, and save the reports in the application, set the WebAPI controller name to the ServiceUrl property of the Report Designer. You can replace the following code in your web Report Designer page.
<div style="height: 500px;width: 100%;">
<bold-report-designer id="designer" service-url="/api/ReportingAPI"> </bold-report-designer>
To preview the Report Designer, build and run the application. You can create stunning professional reports from here.
When you run the application, the Report Designer will render like the following.
Click the data icon in the configuration panel to open the DATA configuration panel.
Click on the NEW DATA icon in the DATA panel.
The Data Fields dialog will open like in the following image.
Edit the name of the data set in the Name field, if required.
To create fields for the data set, click ADD.
Provide the Field Name in the first dropdown list.
In the second dropdown list, choose the data type for the field.
Similarly, you can create multiple fields for the data set.
Click OK . Now, the data set will be listed on the DATA pane like the following image.
Drag a chart report item into the design area.
Switch to the DATA tab in the Properties panel.
Select and drag the numeric column (measure element) or the numeric expression column from the Measures section and drop it in the Y Value(s) section.
Select and drag the dimension element from the Dimensions section to measure against any of the selected numeric columns in the Y Value(s) section and drop it into the Column(s) section.
Now, the final design will look like the following image.
I hope this blog provided a basic knowledge about how to create a report using the Bold Reports Designer in an ASP.NET Core application. To explore further, go through our sample reports and Bold Reports documentation.
If you have any questions, please post them in the comments section. You can also contact us through our contact page or, if you already have an account, you can log in to submit your support question.
Bold Reports now offers a 15-day free trial with no credit card information required. We welcome you to start a free trial and experience Bold Reports for yourself. Give it a try and let us know what you think!