Wednesday, December 18, 2019

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


I have been looking for a solution for reporting, which is free/open source, and only the last week I found something worth mentioning. I am still open to new possibilities for Open Source reporting (usable in .Net core), but that's all I have found until now. Being from the corporate accounting world, my tools are directed towards accountants and business users, which heavily rely 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 reporting tool for my web applications - generate report according to template, and then export in pdf/excel.

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 for 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:


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:


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.







1 comment: