Troubleshooting: How to fix "Remove Blank Lines for Empty Fields" in InDesign Data Merge

I'm working on a card design that has multiple variables within the same text field. Each variable is its own paragraph with its own Paragraph Style.

Original InDesign Document

It's rare that every card has content for each variable ABC though. Usually it's a mix, like AC, AB, or BC. The issue is that when you delete empty lines, sometimes the remaining paragraph gets re-assigned the deleted paragraph's style. Compound this over a whole document and you can see why it's a pain in the butt.


Here's a video explaining the situation:


Here's my solution:
To reliably remove blank lines from a merged document, first do NOT activate "Remove Blank Lines for Empty Fields" in your Content Placement Options. It's often too buggy to be reliable, except in the most simple cases where all of the paragraphs have the same style anyway.

Then Create Merged Document as you normally would. The resulting document will have a lot of blank lines because of the empty fields. Here's what you do about that:

In your merged document, run two Find/Replace searches.

First, you want to delete the strange white space characters introduced by Data Merge. You have to clear these out first since they get in the way of a traditional find/replace for empty paragraphs. In your Find/Change menu, make sure you are in the Text tab and run this search:
Find what: <FEFF>
Change To: Leave this completely empty since we want to delete these empty spaces.
Search: Document
Click "Change All"

Next, you can now delete empty lines. In your Find/Change menu, make sure you are in the GREP tab and run this search:
Find what: ^\s+
Change To: Leave this completely empty since we want to delete these empty spaces.
Search: Document
Click "Change All"

That should resolve any empty spaces you might have in your document.
---
BONUS:
If you happen to have an empty space at the end of your text field that hasn't been resolved by the first two steps, here is an optional third step:

In your Find/Change menu, make sure you are in the GREP tab and run this search:


Find what: \s+$
Change To: Leave this completely empty since we want to delete these empty spaces.
Search: Document
Click "Change All"

It's important you only do this search AFTER you've done the first two, but it should work like a charm.

Hope this helps!

Comments

Popular posts from this blog

5 Graphic Design and Typography Tips for your Card Game

One Thing to Avoid in Game Design

Belle of the Ball Guest Name Generator