“No Fills” GREP styles – Part 1

In a previous post, GREP styles were applied to a data merge to correct the casing of surnames which had been exported incorrectly from a database. In this post, those GREP styles will be built upon to demonstrate how to combine GREP styles with the use of “no fill” as a character style. In Part 1 of this 2 part article:

To fix a salutation line in a direct mail campaign.

This example is a direct mail campaign in the form of a letter which contains a name, address and “Dear” line. The client has no specific field for the “Dear” line but would like such a salutation. However, the “name” field for the database actually contains:

  • Surnames prefixed by any of the titles Mr, Mrs, Ms, Miss or Dr;
  • Business names; or
  • No name at all

For the majority of records, the salutation will read correctly, such as:

Dear Mr Jones,

However, in the instance of a business name in place of a person’s surname, the salutation will look like:

Dear Bunnings Warehouse,

Which is ridiculous. The intent of the campaign is that the letter is meant to be read by the head of a household or business, so any business letter should be addressed to “the business owner”. Finally, some of the records are just addresses with no name and displays as follows:

Dear ,

In instances like this, it is not known if the letter is to a business or individual, so in these circumstances the salutation should be completely dropped. The usual solution:

1)   Do nothing. The old adage “Garbage In, Garbage Out” is usually adopted, resulting in unusual and clearly stencilled letters for any business or unnamed mail.

2)   Microsoft Excel. An additional field would be created using if statements based on properties of the name field. This solution works if the Excel file supplied will only be supplied once, but if the file may be supplied over and over again, this ultimately results in double-handling.

The InDesign GREP solution.

The solution is to apply a paragraph style with several GREP styles which detect if a letter is to a business or unnamed entity and change its appearance to either become “To the business owner” or drop the line completely.

The paragraph style is only applied to the salutation line and nowhere else. The salutation in InDesign appears as follows:

Dear <<name>>, To the business owner

So why are the words “To the business owner” on the line? They are perfectly visible at the moment and the line looks worse than doing nothing. Well, this is where the magic happens using GREP styles. Five Character Styles need to be made and in this example they are:

  • business
  • dear
  • upper
  • NOTupper
  • vanish

The properties for the Character styles are outlined in the table as follows:

STYLE Business Dear NOTupper Upper vanish
General Based on [None] Based on [None] Based on [None] Based on [None] Based on [None]
Basic Character Formats Tracking: 0 Tracking: 0

Case: Normal

Tracking: 0

Case: All Caps

Tracking: 0

Case: Normal

Advanced Character Formats Horizontal Scale: 100%

Vertical Scale: 100%

Horizontal Scale: 100%

Vertical Scale: 100%

Horizontal Scale: 100%

Vertical Scale: 100%

Horizontal Scale: 100%

Vertical Scale: 100%

Character Colour Fill: Black Fill: Black Fill: Black Fill: None

These styles then need to be applied within a Paragraph style using GREP styles. For this example the style is called “text”. Apart from the Basic Character Format dialog box of the Paragraph style, the other details need to be entered:

Advanced Character Formats – Horizontal Scale: 1%

Character Colour – Fill: None

GREP Styles – The following styles need to be applied to the following text searches in this order:

Order Character to apply Text to search for
1 Business To the business owner
2 Vanish Dear , To the business owner
3 Vanish Dear\s(Mr |Mrs |Miss |Ms |Dr ).+
4 Dear Dear\s(Mr |Mrs |Miss |Ms |Dr ).+(?=To the business owner)
5 Upper (?<=Mc)\l
6 Upper (?<=\u’)\l
7 Upper \b\u\l+\-\l
8 NOTupper \b\u\l+-(?=\l)

Once made, this paragraph style has to then be applied to the Salutation line. The result will turn this:

Into this:

As usual, a PDF containing an InDesign attachment of this example can be downloaded here.

In Part 2: Using “No Fills” GREP Styles to correct a Data Merge “Remove Blank Lines” bug.

This site uses Akismet to reduce spam. Learn how your comment data is processed.