Excel Exporter: Dynamically filled header (with customer information) and rows (with orders)

0
Hi all, using the Excel Exporter Marketplace Module, I've managed to get the rows filled dynamically and get static header information in the header. However, I would also like to have the details of the customer displayed in the Excel File, basically just their name and the budget they still have available, something like this:     Is this possible? And if so, how? Thanks in advance for your help!
asked
2 answers
7

HI Jeroen Wijnholds,

As far as I know no module is present in Mendix Market Place for Dynamic Headers. We also had a similar use case and we created a custom java action to create an Excel sheet with Dynamic headers. We used the Apache poi library for it.  You need not explicitly add the Apache poi jar since it is part of the Excel export module. 


Useful links: https://www.geeksforgeeks.org/creating-sheets-in-excel-file-in-java-using-apache-poi/
https://www.codejava.net/coding/how-to-write-excel-files-in-java-using-apache-poi

Hope it helps. All the best !!

answered
3

You indeed need the Apache POI library for it. To make sure you don’t rewrite all export to Excel logic I would suggest adding a Java action that gets the generated Excel file after the ‘GerenateExcelDoc’ Java action from the Excel Exporter module and adds these top rows after it. Reading an existing Excel file and adding two rows is a lot easier and maintainable. 
 

For an example of how this is done with a Word file you could check my Word Template Demo Project available in the Marketplace. The idea is similar; it also uses the Apache POI Library within a Java action to manipulate an existing MS Office file, in this case a Word Template, and adds content based on Mendix data to the Word document.

answered