mail merge insert conditional tab

asked 2019-11-15 00:32:27 +0200

dremelts gravatar image

updated 2020-07-27 16:42:42 +0200

Alex Kemp gravatar image

I have a very complex mail-merge that is creating a membership directory. Some of the fields I would like to have separated by a tab but whether or not the tab character is inserted into the document depends on whether or not the field following the tab is NULL. I don't want to insert the tab if the field is NULL. I can insert conditional text in the document and test whether the field is NOT NULL but there is no way to specify that the text in the "Then" field is supposed to be a tab character because the field does not recognize regular expressions. If I put the regular expression for a tab character in the "Then" field it just prints a backslash t in the merged document.

Any ideas?

edit retag flag offensive close merge delete


I am offering the following suggestion to my own question: In the "Then" field of the conditional text I put a unique sequence of characters, say: #t. Then, in the merged document I do a global search/replace and replace #t with the regular expression \t. This inserts the tabs that I need to get my document aligned properly.

I consider this a hack or workaround - not really the answer to the problem. I'm still looking for a way to insert the tabs into the final document during the merge operation.

dremelts gravatar imagedremelts ( 2019-11-18 14:42:49 +0200 )edit