An example of using the mustache reports server code base to generate reports in docx using node and LibreOffice to convert to PDF.
You will need to make sure both node and libreoffice 5 are installed on your computer to run this example.
This example is rough and ready, please log an issue if you require assistance.
There are now nuget packages which contain the core report rendering logic, removing the need to manually manage node packages in your solution.
The word file generations happens using docx-templater and xlsx-template. It is written in node and uses mustache templating to populate the report. You will need to model your report data in JSON for the templating to work, and because docx-templater is so awesome you can use angular expression to modify reporting data at runtime. It is unknown if xlsx-template also supports angular expressions, if not I will add it soon.
Have a look at reportRender.js ReportRender.prototype.configureAngularExpressions method - you can add your own customer angular expressions here.
Please note there are currently plans to abstract this allowing your to specify your own angular expressions file without needing to modify the core package. This is one of my main focuses
I have also added a custom image handling code to allow for base64 encoded image data to be part of the JSON payload - have a look at reportRender.js ReportRender.prototype.getOptions method for more detail. Please note this is now a paid for feature of docx-templater, good thing we got the last version of the open source image module
This example makes use of TddBuddy's Clean Architecture and Synchronous Process Execution packages.
-
Synchronous Process Runner - DotNetCore
- Install-Package TddBuddy.Synchronous.Process.Runner.DotNetCore
- Source @ https://github.com/StoneAgeTechnologies/Synchronous-Process-Runner-DotNetCore
-
Clean Architecture Domain - DotNetCore
- Install-Package TddBuddy.CleanArchitecture.Domain.DotNetCore
- Source @ https://github.com/StoneAgeTechnologies/CleanArchitecture-DotNetCore.git