Text with line feed to Word document

Hello,

I would like to transfer a text block with line feed to Word.

Source:
[
{
“Address”: “Martin Sample\nTree avenue \n12345 Newton”
}
]

“value”: “Martin Sample\nTree avenue \n12345 Newton”,

Word document
{{address}}

Results
Martin Sample Tree avenue 12345 Newton

How can I turn the string “\n” into a line feed in Word?

I am grateful for any help.

Best regards, Helmut

Translated with DeepL Translate: The world's most accurate translator (free version)

Welcome to the Make community!

You’ll have to set up three separate placeholders on three separate lines.

E.g.:

address1
address2
address3

This is because you can only use HTML to add formatting like newlines, when not creating a document from a template.

samliewrequest private consultation

Join the unofficial Make Discord server to chat with us!

2 Likes

Hello,
Thank you for the suggestion. This is only a workaround for me. I would prefer it if control characters such as “Return / Linefeed” or “Tab” etc. could be passed and displayed by Word.
Greetings, Helmut

Hi @HHoltstiege
You have to use <br> tag for new line in HTML.
So while passing the value you can replace \n with <br> using replace function .

If you require additional assistance, please don’t hesitate to reach out to us.
MSquare Support| Book Live Implementation
Visit us here
Youtube Channel

1 Like

Hallo Support-Team,

vielen Dank für den Tipp. Ich habe es gleich versucht im Scenario:
https://eu2.make.com/149082/scenarios/1211360/edit
Die Zeichenfolge wird jedoch nicht ersetzt - siehe In- und Output Bundle content

Variable
{{get(map(1.document.indexFields; “Item”; “FieldName”; “ADRESSE”); 1)}}

[
{
“scope”: “roundtrip”,
“variables”: [
{
“name”: “Adresse1”,
“value”: “Herr \nMax Mustermann\nHansaring 12\n48161 Münster”
}
]
}
]
[
{
“Adresse1”: “Herr \nMax Mustermann\nHansaring 12\n48161 Münster”
}
]

Variable
Versuch 1: {{replace(53.Adresse1; “\n”; “
”)}}
Versuch 2: {{replace(53.Adresse1; “\n”; “
”)}}

[
{
“scope”: “roundtrip”,
“variables”: [
{
“name”: “address2”,
“value”: “Mr \nMax Mustermann\nHansaring 12\n48161 Münster”
}
]
}
]

[
{
“Address2”: “Mr \nMax Mustermann\nHansaring 12\n48161 Münster”
}
]

Then I TESTWISE replaced only the “n” with
.
But no break was inserted in Word:
Herr Max Musterma

Ha
sari
g 12 48161 Mü
ster

Hallo Support-Team,

vielen Dank für den Tipp. Ich habe es gleich versucht im Scenario:
https://eu2.make.com/149082/scenarios/1211360/edit
Die Zeichenfolge wird jedoch nicht ersetzt - siehe In- und Output Bundle content

Variable
{{get(map(1.document.indexFields; “Item”; “FieldName”; “ADRESSE”); 1)}}

[
{
“scope”: “roundtrip”,
“variables”: [
{
“name”: “Adresse1”,
“value”: “Herr \nMax Mustermann\nHansaring 12\n48161 Münster”
}
]
}
]
[
{
“Adresse1”: “Herr \nMax Mustermann\nHansaring 12\n48161 Münster”
}
]

Variable
Versuch 1: {{replace(53.Adresse1; “\n”; “
”)}}
Versuch 2: {{replace(53.Adresse1; “\n”; “
”)}}

[
{
“scope”: “roundtrip”,
“variables”: [
{
“name”: “address2”,
“value”: “Mr \nMax Mustermann\nHansaring 12\n48161 Münster”
}
]
}
]

[
{
“Address2”: “Mr \nMax Mustermann\nHansaring 12\n48161 Münster”
}
]

Then I TESTWISE replaced only the “n” with
.
But no break was inserted in Word:
Herr Max Musterma< br >< br > Ha< br >sari< br >g 12 48161 Mü< br >ster

Hi @HHoltstiege
Here is a sample
Please note that you do not need to use quotes in the replace function.


output:
image

1 Like

Yes, i understound the formula. But in this case it doesn´t work.

Screenshot of the Formula - Example “

image

Screenshot of the Formula - Example “XXX”

image

The solution is always the same:

Screenshot of the output bundle

Then i replace the Backslash

image

Screenshot of the output bundle

You see “n” was replaced to “XXX” - but “\n” stays forward.

Any idea?

This ist the scenario:
CRLF2Word | Make

To replace newlines, you have to use the special variable {{newline}} (NOT \n or not n)

or use a regular expression pattern like

/[\n\r]+/g

samliewrequest private consultation

Join the unofficial Make Discord server to chat with other makers!

1 Like

Thank you - :wave: - both suggestions correctly replace the line feed in the string
. However, this does not lead to a line break in the Word Editor, but is output in plain text. Is there an idea for this?

image

To use HTML tags like <br> in Google Docs, you can only use the “Create a Document” and not “Create from Template” module, which does not accept HTML.

samliewrequest private consultation

Join the unofficial Make Discord server to chat with other makers!

1 Like

I do not necessarily want to use HTML tags. This was the result of a previous tip.
Rather, I would like to use Word natively and exchange content.
It is therefore probably not possible to transfer content with line feeds when using a template. :sleepy:

This ticket can then be closed. Thank you for your support so far.