Simple Export to Excel
Use this module to export a list of persistent or non-persistent objects from your Mendix app. To be used anywhere, from List Views, to single buttons and Datagrids. There is no need to download Mx Model Reflection or set this module up from the frontend. Associated objects will not be exported.
You can use this module to export a list of persistent or non-persistent objects from your Mendix app. To be used anywhere, from List Views, to single buttons and Datagrids. To use this, there is no need for set up Mx Model Reflection or setting up Excel templates from the frontend. Associated objects will not be exported.
Typical usage scenario
If you want to be able to export a list of objects to Excel with a few actions in a microflow, without the need for having a complex setup with Mx Model Reflection and having to use templates that you have to set up in the frontend.
Features and limitations
The goal of this module was to create a simple way to export objects to Excel without the need of complex set up in the frontend.
- Exporting a list of objects to Excel with an action in a microflow. To be used anywhere: from List Views, to buttons and Dataviews, without the need of setting up Mx Model Reflection or setting up templates in the frontend.
There are few limitations to this module:
- Related objects will not be exported.
- For enumeration, it was decided to export the enumeration name, not the caption.
- Hashed strings will be exported as Bcrypt encoded value.
- Exporting binary attributes is not supported.
- Exporting a large number of objects (>10.000) is possible. However, it can take a while. Setting up a queue is advised.
Developed for Mendix 10.3.1. Soon other versions will follow.
Dependencies that are managed by this module:
- org.apache.poi - poi - version 5.2.3
- org.apache.poi - poi-ooxml - version 5.2.3
- org.apache.poi - poi-ooxml-full - version 5.2.3
- org.apache.xmlbeans - xmlbeans - 5.1.1
- org.apache.commons - commons-collections4 - version 4.4.
- org.apache.commons - commons-compress - version 1.24.0
How to use this module
In the ‘Example’ folder, you can find an example implementation of using the ExportListToExcel action.
Check out ACT_ExportExampleListToExcel to see an example implementation. You can create your own microflow and implement the Export To Excel functionality as follows:
- First, retrieve the list of objects you want to export. This can be a list of persistent or non-persistent objects. Please note, that only this list will be exported to Excel, and not the objects associated to this object.
- Then you have to create a file that the Excel will be mapped to. In the example implementation an instance of ExcelDoc is created. Make sure it’s an entity that inherits from System.FileDocument. If you want your file to be deleted directly after download, set the DeleteAfterDownload attribute of this object to true.
- The next step is to call the ExportListToExcel action.
- The ‘Input list’ is the list of objects you retrieved in step one.
- The ‘File doc’ is the file you created in step 2.
- ‘Excel name’: here you can give a name to your Excel that should be created.
- ‘Auto resize columns enabled’: the recommendation is to set this to false. When set to false, all columns will have the same, default size. When set to true, auto width is applied to adjust the width of the columns depending on content. This will make your export considerably slower. Please use wisely.
- ‘Log node name’: here you select what log node errors should be logged to.
- Finally, make sure to add a ‘Download file’ action to download the Excel the ExportListToExcel action has created.