loading...
Cover image for Open Source Reporting Solution (FastReport) - Simple Demo with .NET Core

Open Source Reporting Solution (FastReport) - Simple Demo with .NET Core

zoltanhalasz profile image Zoltan Halasz ・2 min read

I have been looking for a solution for reporting, which is free/open source, and only the last week I found something worth mentioning. Being from the corporate accounting world, my tools are directed towards accountants and business users, which rely heavily on such reports, and I would like to see an open source/free reporting tool to serve this purpose.

I know, there are other solutions such as Telerik and Syncfusion, but they seem to be expensive for my level.

In fact, all I need is a tool for my web applications - to be able to integrate in asp.net core, then generate a report according to template, and then export in pdf/excel.

Alt Text

The solution I am dealing here with comes from FastReport, which just has published its OpenSource version:
https://fastreports.github.io/FastReport.Documentation/
https://github.com/FastReports/FastReport

I have prepared a small tutorial which takes a list of employees and publishes a report with them.

Prerequisites:
A. Basic .Net Core MVC
B. Nuget Package - FastReport.OpenSource.Web (take latest one for 2019)
C. There is an frx file, which is an XML document describing the report itself. I manually edited the sample report, to fit my sample data. It is saved in my wwwroot folder, simple list.frx.
D. Main difference to their tutorial is that I take data from my list, not the XML database of Northwind. Clone their git repo, and see how it runs for their
data: the Web.MVC folder contains the relevant .net core MVC example: https://github.com/FastReports/FastReport/tree/master/Demos/OpenSource
E. There is a report editor/designer, Fast Report Designer Demo for trial purposes. Download it.
Also, download the https://www.fast-report.com/en/product/fast-report-viewer/, it's a free tool.

Application is live under: https://fastreport.zoltanhalasz.net/

Steps to understand the tutorial:

  1. Clone my github repo https://github.com/zoltanhalasz/FastReport.Tutorial
  2. Check the logic in the controller and also the service I use to populate the report (it differs from their example - I take a list as an input, not an XML file as opposed to their example). The template of the report is an xml file, with frx extension, saved in wwwroot folder. I edited manually one of their simple examples to fit my requirements for the tutorial.
  3. Check the View (from Views/Home/Index), how it takes the report and publishes it via Razor.
  4. Run the application, result should be as below: Alt Text
  5. Save the report, in .fpx format. Then with the downloaded viewer (at point E above), you can open the populated report and then save in excel, pdf, word etc. The result should be: Alt Text

I hope I can study this further and apply in one of my future projects!

Let me know your thoughts about this topic, how you would apply open source reporting to .net core.

Posted on by:

zoltanhalasz profile

Zoltan Halasz

@zoltanhalasz

.Net enthusiast, self-taught, career transition, C#, SQL, Javascript

Discussion

markdown guide
 

What I have been exploring is Jasper Reports with their Report Server. It exposes REST JSON APIs that I can then call from other applications. The resulting report can then be streamed via the HTTP response. I have found it perfect for my needs and will probably be expanding on its use in my applications in the future. A bonus is that you can get a report's parameters from an API and so could generate dynamic inputs in whatever program is consuming it. I definitely suggest Jasper Reports to anyone looking for an alternative to something like Crystal Reports.

 

Thanks. But can they be integrated in an asp web app? Or server is a must? Do you have a working example?

 

Dear Mr.Halasz
Thank you very much for this article, i was looking for a free/opensource reporting tools for Core 3,for along time until i came across your great article.
But when i try to print the report the Print From Browser icon dos not print.
Is there a way to print the report or it is disabled in the open source.
BTW. i am using Blazor Server with core 3.0.
Your help will be very much appreciated.

 

Hi,

please check the sample app running, fastreport.zoltanhalasz.net/, print from browser. It seems to work fine here.
second option, try to use my code, and see if it works locally, it is using .net core 2.2 or below. github.com/zoltanhalasz/FastReport...
third option, save the prepared report in fpx format, and then install the Fastreport viewer fast-report.com/en/product/fast-re..., which can open it and save in pdf/xls, or print it.
Honestly I did not try with .net core 3.0 or above... no Idea why it doesn't work.

 

First Of all thank you very much for your quick response.
sorry it was my mistake because im trying to press the icon it self i should click on the word says Print From Browser.
Please if you came across any thing that help with using fast report with Blazor.
Please kindly notify me on the following email: T.Alkathiri@Gmail.com.
I will much appreciate your help

 

UPDATE: Just learned they are on on holiday until January 11th!
That explains why I cannot get replies to my tickets or phone calls at all. I've build a .NET Core 3.1 solution. (Your example, though good, generates an embedded PDF (iframe) which prints with a dialog.) We can find no way in Core to print (without the print dialog, directly... as within my .NET Core console app which we will run as a Windows Service.)

Also, these objects seem to be completely undefined in Core, even though we've purchased their Enterprise product:
myReport.Report.PrintPrepared(settings);
myReport.Report.Print();

Please help any way you can!

I really don't know the answer to your question. Try exporting the fpx file, and print it with the report viewer application, maybe this solves your question. But I didn't study this deeper to be able to help you.

 

Hello. Nice article. I have a couple of questions though...

1.)Im not sure if this is free? I think the demo can only print 5 pages and there's a watermark indicating that its a demo version.
2.)How did you design the report? Do they have a designer? I went to their website and saw they have an online designer. Is there an offline designer that is integrated with Visual studio?

Thanks

 

I designed the fpx file starting from one of their demo files and then editing the xml file in VS Code.
The viewer is free, so you can export any report from your app in fpx format and print it from the viewer, or export to excel, pdf, word fast-report.com/en/product/fast-re...

 

I see. So you edited the xml from visual studio. So if you wanted to use the designer to create a report, then you need to buy? Or you can use the designer for free?
I'm quite sure that the demo trial can only print 5 pages max though it was mentioned on their website.

Try their demo for designer.
fast-report.com/en/product/fast-re...

as for printing, I tried to print to pdf from the app, and it printed all pages, except that sometimes it inserts empty pages.

using the report viewer (free), opening the fpx file will print only 5 pages.

Please do also your own research and contact them.

 

How To Run Fast Report on Asp.net MVC5 Full Framework 4.5.2
unable to install package FastReport.OpenSource.Web 2020.3.14 in vs2017

please help , can fastreport run on Asp.net MVC5 Full Framework 4.5.2
you may reply me on sachinmakhre@gmail.com

 

Is it possible to create report with image in the background? This is needed for complicated forms.

 

I am not sure. Please check their showcase fast-report.com:2018/6