directly adjacent labels (in single cell) in document template

Ho do I achieve the following in a Mendix document template: Dear {mr. or ms.} ' ' {} , I am able to do this in a cumbersome way by: creating an entity with parameters for the template setting a parameter on the entity from within the microflow (e.g. entity.letterStart = 'Dear mr. Jones," creating a dataview in the template and assigning the entity to the dataview adding a dynamic label to the dataview and assigning the parameter to the label: e.g. {letterStart} I however prefer to create adjacent labels (in a single cell) directly in the template. If this is not possible, is it possible to somehow set the cell-width to auto in order to fake having floating text? Kind regards, Philip
2 answers

Since you can't use conditional visibility in document templates, you need:

  • A label that says "Dear "
  • An attribute on the Customer entity which contains either "Mr. " or "Ms. " (i.e. a Title attribute)
  • An attribute on the Customer entity containing the last name

You can then create a 1 row, 3 column table: Dear | (Title) | (LastName)

What remains is you have to play around with the cell spacing properties, or set manual styles for "padding-left" or "margin-left" - sometimes in these scenarios setting a negative margin-left (for example: margin-left: -10px) on the Title & LastName cells will work.

Since you're using three columns in the table, the actual length of the name / title doesn't matter as it will calculate from the starting point of the cell.


You could also take a look at the email module and use the custom token replace java action to manipulate the string that you pass to the document template.