Include Images in an Excel Export

0
Hi,Can Mendix export images directly into Excel?Or is it only possible for text and numbers?Thanks!
asked
2 answers
0

Hi Ibrahim,

Out of the box, the standard Mendix Excel export functionality is primarily intended for text, numbers, dates, and other attribute-based data. It does not automatically embed images stored in System.Image or FileDocument entities into Excel cells.

If your requirement is simply to make images accessible from Excel, a common approach is to export:

  • The image filename
  • A document identifier
  • A URL pointing to the image

Users can then open the image from the exported workbook.

If you need the actual image embedded inside the Excel file, then you'll need a custom implementation. The approach I've used is:

  1. Generate the Excel workbook using a Java action.
  2. Retrieve the image content from the Mendix System.Image / FileDocument.
  3. Use Apache POI to insert the image into the worksheet.
  4. Resize rows/columns as needed so the image is visible.

The resulting Excel file will contain the image itself rather than just a link.

One thing to consider is file size. If you're exporting hundreds of records with images, the Excel file can become quite large and generation time may increase significantly. In those scenarios, exporting image URLs is often a more scalable solution.

So, in summary:

✅ Text, numbers, dates: Supported out of the box

✅ Image URLs: Easy to implement

✅ Embedded images: Possible, but requires custom Java development (typically using Apache POI)

❌ Embedded images: Not supported by the standard Excel Exporter module alone

Hope this helps.


answered
0

Hi Ibrahim,


Yes, Mendix can export data to Excel, but images are different from normal text/number attributes.

If you're using the standard Excel Exporter, it generates the Excel file from the configured data/template and doesn't provide a built-in option to embed a System.Image or System.FileDocument directly inside an Excel cell.


You have two practical options:

1. Export the image URL

If the image is accessible through a URL, export that URL as a normal Excel value. Users can then click the link to open the image.

2. Embed the image inside the Excel file

If the requirement is for the image to actually appear inside the Excel worksheet, you need custom Excel generation. A Java Action using Apache POI is a good approach:

Mendix Image/FileDocument
        ↓
Retrieve binary content
        ↓
Apache POI
        ↓
Workbook → Sheet → Row → Cell
                         ↓
                  Add Picture
        ↓
Download .xlsx

The important part is that the image binary has to be read from the Mendix System.Image/System.FileDocument object and added to the POI worksheet as a picture. Mendix supports working with the binary content of these entities, but the actual Excel image embedding is custom logic.


So if you only need image links, Excel Exporter is enough. If you need the actual image displayed inside the Excel sheet, I would go with a custom Java Action/POI implementation.


Hope this helps.

answered