I have an InDesign document with a data source (csv). Part of the template looks like this:
<<first-title>><<first-text>><<second-title>><<second-text>><<third-title>><<third-text>>
The reason it is all on one line is because a variable can be empty and I don't want it to create empty lines.
The texts (<<first-text>>, <<second-text>> and <<third-text>>
) should contain newlines, but that is not possible with csv data merge. I did find a solution with a character style and a paragraph style to mimic a newline (https://indesignsecrets.com/controlling-line-breaks-with-data-merge.php) but that just introduces some whitespace for me, no newlines.
So I thought, I'll just make a script to replace some string (I chose _LB_
) with a linebreak (\n
). That works when I put that string (_LB_
) in the text and then run the script, it is replaced with a newline. But that does'nt work with data merge, since you cannot (or I can't find how) run a script automatically for each data entry?
Is there another, better solution for this you may know of?