Simple Export to Excel

Content Type: Module
Categories: Import/Export

Overview

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. 

Documentation

Description

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. 

Features:

  1. 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:

  1. Related objects will not be exported. 
  2. For enumeration, it was decided to export the enumeration name, not the caption.
  3. Hashed strings will be exported as Bcrypt encoded value. 
  4. Exporting binary attributes is not supported.
  5. Exporting a large number of objects (>10.000) is possible. However, it can take a while. Setting up a queue is advised. 


Dependencies

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


Configuration

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: 

  1. 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.
  2. 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. 
  3. The next step is to call the ExportListToExcel action. 
  4. The ‘Input list’ is the list of objects you retrieved in step one.
  5. The ‘File doc’ is the file you created in step 2.
  6. ‘Excel name’: here you can give a name to your Excel that should be created.
  7. ‘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.
  8. ‘Log node name’: here you select what log node errors should be logged to.
  9. Finally, make sure to add a ‘Download file’ action to download the Excel the ExportListToExcel action has created. 



Releases

Version: 1.0.0
Framework Version: 10.3.1
Release Notes: Framework version: 10.3.1 Publish date: October 27, 2023 Release Notes Initial release with working functionality to export to Excel.