This is part 2 of the “No fills” GREP styles articles. In this post, the “No fills” GREP Styles are used to overcome a Data Merge glitch within InDesign when the “remove blank lines” checkbox is selected. An example has been created which contains an Email, Direct number and Mobile number. Here is how the file looks without any data in it.
Here is how the file looks with the first record.
Good so far. Won’t win any awards, but all the fields are populated. How about the next record?
Now there is an issue. There is no number for the Direct field but the word Direct implies that there is. This looks untidy, it would be good if this line would disappear. “Remove Blank Lines for Empty Fields” should solve this.
OK, this hasn’t solved the situation. It must consider the word “Direct” to be content of the line, regardless if there is data or not. What if the prefixes (Email, Direct, Mobile) weren’t in the type as such but were bullets for example? Easy enough to make them using Paragraph Styles, so this will be demonstrated using the Email field. This will be done on a new page to compare results.
This Paragraph Style will be duplicated twice to make styles for the Direct line and the Mobile line, with the prefix being the only thing to change amongst the Paragraph Styles.
So this should work. How does the first record look?
Good. How about the second record?
Excellent. The word “Direct” has disappeared as intended and the Mobile line is now underneath the Email line. How about the third record?
Bad. The line which should start with the word “Direct” now starts with the word “Email”. It is almost as if InDesign’s “Remove Blank Lines for Empty Fields” feature has deleted the line but inadvertently taken the Email line formatting. This is a glitch, but occurs during the preview only.
However, it could be a costly glitch, especially if the glitch is inadvertently triggered via the Preview.
So is there an alternative way to do this so that this issue is avoided? GREP Styles. Again, this will be done on a new page to compare results.
The following character styles need to be set up. Apart from the font type and size, the settings required are as follows:
|General||Based on [None]||Based on [None]||Based on [None]|
|Character Colour||Fill: Red||Fill: Paper||Fill: None|
Now the following paragraph styles need to be set up. Again, apart from the font type and size, the settings required are as follows:
|GREP styles||Apply: nothing
to text: ^\+.+
To text: ^1800.+
To text: Direct\t(?=\+|\d)
|Character colour||Fill: Paper||Fill: None|
Set the text so that only Email and Mobile have their prefixes showing, but with the placeholders in place. Note the position of the “Direct” field – this is on purpose.
Next, copy and paste in place the text onto a new layer. Format the text so that the first line is a hard return and that the next line is formatted as pictured.
Once done, begin with record one
That worked. How about the second one?
Good, but the third one fouled up before. Is it good now?
FINALLY! How about record nine… this doesn’t start the way the other numbers do
FANTASTIC! The GREP style took this into consideration when it was created.
Yes, this example is not a turn-key solution to EVERY Data Merge glitch, but the use of “no fill” GREP styles can be, provided the GREP styles are carefully tailored to the situation. This post is simply to demonstrate the power of GREP styles with “No fill”.
As usual, all necessary files can be found as attachments within the PDF of the file here. The PDF was made prior to “activating” the glitch, but can easily be done in the InDesign file by toggling back and forth through pages in the Data Merge preview.