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

**URL:** https://community.make.com/t/loop-in-the-microsoft-word-module-with-variables-leaving-a-space/33108
**Category:** Questions
**Tags:** api
**Created:** [April 8, 2024, 4:12pm UTC](https://community.make.com/t/loop-in-the-microsoft-word-module-with-variables-leaving-a-space/33108 "2024-04-08T16:12:32Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![nsouza](https://avatars.discourse-cdn.com/v4/letter/n/f08c70/32.png) [@nsouza](https://community.make.com/u/nsouza)
#### Post date: [April 8, 2024, 4:12pm UTC](https://community.make.com/t/loop-in-the-microsoft-word-module-with-variables-leaving-a-space/33108/1 "2024-04-08T16:12:32Z")

</div>

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](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/a/1/a190754a2e7a6b866ae2caeaf13404ba0400f4d9.png)

Result:  
 ![image](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/c/c/ccd5669b46e786e73caabdddecbad7447aa4aa52.png)

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

---

<div class="post-metadata">

### Author: ![samliew](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/samliew/32/13327_2.png) [@samliew](https://community.make.com/u/samliew)
#### Post date: [April 8, 2024, 4:26pm UTC](https://community.make.com/t/loop-in-the-microsoft-word-module-with-variables-leaving-a-space/33108/2 "2024-04-08T16:26:51Z")

</div>

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.

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

```

 ![Screenshot_2024-04-09_000414](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/3/b/3b8fbe6166d21a37a307e5a289c854a1d7704a62.png)

---

<div class="post-metadata">

### Author: ![nsouza](https://avatars.discourse-cdn.com/v4/letter/n/f08c70/32.png) [@nsouza](https://community.make.com/u/nsouza)
#### Post date: [April 8, 2024, 4:48pm UTC](https://community.make.com/t/loop-in-the-microsoft-word-module-with-variables-leaving-a-space/33108/3 "2024-04-08T16:48:02Z")

</div>

> [@samliew](#):
>
> `ne;`

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.

---

<div class="post-metadata">

### Author: ![Make\_Bot](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/make_bot/32/14661_2.png) [@Make\_Bot](https://community.make.com/u/Make_Bot)
#### Post date: [July 7, 2024, 4:49pm UTC](https://community.make.com/t/loop-in-the-microsoft-word-module-with-variables-leaving-a-space/33108/4 "2024-07-07T16:49:04Z")

</div>


