Loop in the Microsoft Word module, with variables leaving a space

Hello,
I’m facing the following issue: I’m using the loop from the Microsoft Word module. Everything is working fine, however, in one cell, I have a finite number of variables, but with a variable quantity. In some cases, it can be 1 and in others up to 10. When the variable is not filled, the cell/table ends up with empty spaces, losing its formatting. What could be done to solve this case?

Template:
image

Result:
image

In summary, is there any way, in these cases, where the variables were not filled, to not leave a space?

In your template, put your variables in a single line like this:

{{item 1}} {{item 2}} {{item 3}} …

Then, when you map the field, you can use an if + length function to check if the value is not empty, and if not empty insert an additional newline.

{{ if(length(1.myTextVariable) > 0; 1.myTextVariable + newline; emptystring) }}

2 Likes

The ‘newline’ command works for almost everything. But it doesn’t work in this Word module. Even with this command, it stays on the same line. If I send it formatted as well, everything stays on the same line. I haven’t found a way to move to a new line through the Make module.

1 Like