Creating a pdf with dynamic columns

Hi, I am trying to generate a pdf that contains a list with 13 columns in total. Because not every user needs all the columns i want to give them the option to decide for themselves which columns they want printed on the pdf. Doing this with document templates seems like a very hard thing to do. Does anyone have ideas how to accomplish this? Creating 100 different documents is not a solution ofcourse, another idea might be to create a dynamic html table in a microflow and feed that as a string in an attribute value, but that doesn’t seem very ideal either. I've played around with visibility conditions but they seem to only work on rows, not columns. 
2 answers

You could create a specific domain model for this that you fill before generating the PDF:

  1. Create an entity with the column headers as attribute and attributes for the data beloning to each header.
  2. In the microflow of the pdf generation create an object with all the headers based on the users choice and a boolean that this is the header object
  3. Create the objects with the data 
  4. In your document template use a template grid to show the entity. Use conditional visibilty to show the header entity on top with the header attributes. The data entities should be shown after this.

Not the most beautiful option but it works.


Does this example help:

The first row is conditional visible based on the header boolean set true. The second the header boolean should be false.