When performing a data merge in InDesign, is there a way to conditionally include a space between fields? Something like as follows:

<<Title>>[conditional space here]<<Name>>

Not all records have a <<Title>> and Remove blank lines for empty fields is checked.

2 Answers 2


Alternatively, you can use a GREP style to make this "conditional space" visible or not. Please note this workaround would work assuming your paragraph starts with "Title" or "Name", otherwise we shall think differently...

1- Insert a normal space between your fields:

<<Title>>[normal space]<<Name>>

2- Create a character style (let's call it "invisible"). Set Font size to minimum (0.1pt) and approach to -1000.

3- Open your paragraph style settings, go to GREP style and apply this "invisible" character style to a space at the beginning of the paragraph. Use Grep regex: ^\s. This way, if there is no "Title", you'll have [invisible space] + "Name".

enter image description here

  • 1
    Nice trick. FWIW Colin Flashman many other great datamerge techniques at colecandoo.com. But at some point it's better to start on working with professionnal plugins that will bring hogher levels of productivity and smoothness.
    – Loic
    Sep 21, 2017 at 9:52
  • Merci pour le lien @Loic.
    – Vinny
    Sep 21, 2017 at 12:56
  • My pleasure @Vinny
    – Loic
    Sep 21, 2017 at 15:33

Not out of the box. The data merge functionality in InDesign is quite limited – although good enough in most cases. An Xmpie plugin could do it, but that might be an expensive solution if the project isn't very big.

What may work is doing the data merge into a new ID file instead of exporting directly to PDF, and then do a find and replace on for instance on beginning whitespace.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.