logo
small logo
  • Products
  • Buy
  • Support
  • Articles
  • Customer panel Support
    • en
    • pt
    • es
    • de
    • pl
    • JP
    • ZH
  • Home
  • /
  • Articles
  • /
  • How to use WebReport with ASP .NET Web Core application
  • Report generators family FastReport brief review

    March 23, 2020

    Without reporting it is impossible to carry on business in any sphere of life. Bureaucracy

    read more
  • How to update the FastReport.Core web report

    September 21, 2020

    Sometimes you need to update the report, for example if you input a new variable

    read more
  • How to use FastCube .NET in the SPA application Knockout.js

    July 21, 2021

    To output the data cube, we will create a SPA application by means of Knockout.js

    read more
  • How to create a report from web application code

    February 16, 2022

    Sometimes creating a report can turn into to be a real headache. For example, when

    read more
  • How to use FR Core Web Report in Single Page Application Angular 7

    April 29, 2019

    The concept of one-page apps is finding an increasing number of supporters. One of the

    read more

How to use WebReport with ASP .NET Web Core application

January 17, 2018

Recently FastReport introduced a new library under the .NET - FastReport Core platform. This is a special version of FastReport.Net for working with ASP .NET Core. The first version of the library did not implement the WebReport object and OnlineDesigner. We had to export a report to HTML, and then pass it to the view. And now, in FastReport .NET 2018, the familiar WebReport and OnlineDesigner components have appeared.

In this article, we'll take up how to use WebReport in an ASP .NET Core application.

So, create an ASP .NET Core Web Application:

 

Select the Web Application MVC template:

It's very easy to use WebReport in .NET Core applications. Previously additional project settings, connection of libraries, scripts and so on were required. Now, just install the nugget package FastReport.Web, which is located in the folder:

С:\Program Files (x86)\FastReports\FastReport.Net\Nugets

To see the packages in the nuget manager, you need to add a local package source. Open the package manager. In the upper right corner, select Local package source. Nearby there is the icon of the settings:.

 

Open the settings of the package manager. Specify the path for the local source of the packages:

After that, we can choose the available FastReport packages:

Install the package FastReport.Web. Now you can go directly to creating the application. Open the class HomeController.cs.

Add several libraries in the “using” section:

1
2
3
using FastReport.Web;
using System.Text;
using System.Data;

Add the following code into the “Index” method:

1
2
3
4
5
6
7
8
9
10
11
public IActionResult Index()
 {
 Report = new WebReport();
 Report.Report.Load($@"Reports/Simple List.frx");
 
 var dataSet = new DataSet();
 dataSet.ReadXml(@"Reports/nwind.xml");
 Report.Report.RegisterData(dataSet, "NorthWind");
 ViewBag.WebReport = Report;
 return View();
 }

Here, we create a web report object. Then load the report from the Reports folder. First you need to add this folder to the project and put the Simple List.frx report and the nwind.xml database, which can be found in the FastReport.Net package in the Demos folder.

Next, we create a data source and load our xml database into it. After that, we register the data source in the report. Finally, we assign a report to the ViewBag object.

Let's move onto the Index.cshtml view. Here's what the page code looks like:

1
2
3
4
@{
 ViewData["Title"] = "Home Page";
}
@await ViewBag.WebReport.Render();

We used the await statement to wait for the execution of the task of the asynchronous method Render (). Using an asynchronous method does not block the site while waiting for the report to be displayed.

To  finish up, open the class Startup.cs and add one line to the “Configure” method:

1
app.UseFastReport();

So we connected the FRCore library to the application.

That's all. Run the application:

 

As you can see, using WebReport in .Net Core is easier. No settings are required, we just install the nuget package and use the WebReport object.

about product download buy
avatar
Dmitriy Fedyashov
Technical Writer
Fast Reports Team: Dmitriy Fedyashov - Technical Writer at Fast Reports
.NET FastReport ASP.NET Core WebReport

Add comment
logo
  • 800-985-8986 (English, US)
  • +4930568373928 (German)
  • +55 19 98147-8148 (Portuguese)
  • info@fast-report.com
  • 901 N Pitt Str #325 Alexandria VA 22314
  • Buy
  • Download
  • Documentation
  • Testimonials
  • How to uninstall
  • Ticket system
  • FAQ
  • Tutorial Video
  • Forum
  • Articles
  • Our News
  • Press about us
  • Resellers
  • Contact us

© 1998-2022 by Fast Reports Inc.

  • Privacy Policy