Prism 6 does not have a report framework built in. I need a report framework which would use FO XSL templates as the inputs and create PDF files. I choose FO.NET. My need for FO XSL templates is due to them being a requirement for a third party software tool I maintain.
FO.NET seems to be an abandoned open source project. The last release was mid-2009. I did not like to see it abandoned but, since it is open source, I can add any features I need with ease.
After using it in 4 projects now, I am impressed. I would like to add SVG image support in the future. And, I suspect, the developers who created FO.NET, now offer a paid reporting framework called, iTextSharp.
In the report module, I organize the files in folders to separate the images, templates, view models, and views.
The images and templates are content files that must be copied into the Shell project. To do this automatically during a build, add folders and add a link to the existing files from the report project.
The IncomeStatementViewModel contains a method to print a sample report. This is a simple way to check to see if you have the FO.NET dependencies working properly.
In our report we will be generating the ".FO" file dynamically using XML and XSL. The sample is hard coded for testing.
FonetDriver is the class name for this reporting system. The static method Make(), creates a new instance of FonetDriver.
We setup an error handler and then render the report. The render method has different overrides to accept file path strings.
This is partial view of the example ".FO" file. It is a XML structure with a fo name space to w3.org.
The report should create a report that looks like this.
The complete source code for this project is located on Github.
If you found this article helpful use the tweet button below to spread the word. Thank you.