How do I hide a blank address line (or a NULL field value) when doing a mail merge?

From Apache OpenOffice Wiki
< Documentation‎ | FAQ‎ | Writer‎ | Printing
Jump to: navigation, search


How do I hide a blank address line (or a NULL field value) when doing a mail merge?


Documentation note.png May need to be checked for accuracy


Mail addresses for letters or envelopes have a different number of lines. There are two separate things you have to do.

Firstly create the form letter with all the fields that might appear - test that it works and that is shows extra blank lines and spaces where some fields are null.

Then you need to do the work required to make the extra spaces/paragraph marks disappear.

Consider a layout like this:

<First_Name>[space]<Surname>[Return] <House_Name>[Return] <House_No>[space]<Number_Modifier>[space]<Street>

Some houses don't have names, and some addresses are of the form 13 b High Street and some are 121 Acacia Avenue.

You do this by running a test on the values.

First ensure that Hidden Fields are shown on screen, otherwise you will get in a terminal head spin. This is the menu option: View->Hidden Paragraphs

To make the line disappear, put the cursor between and [Return] and choose the menu option: Insert->Fields->Other (or [CNTL][F2] if your desktop manager doesn't intercept it).

The third tab is Functions - choose that. The option Hidden Paragraph is the one we want.

On the right hand side there are three options for invoking a hidden paragraph. We just want the Condition.

Enter 'not(House_Name)' - without the quotes. This tests the field, and if it is empty makes the para disappear. You could also use the condition 'House_Name EQ ""' - this format should be used when the database returns a NULL, with '""' replaced by 'NULL'.

To make the extra space after disappear, select the space. Chose Insert->Fields->Other and the Functions Tab. This time you select 'Hidden Text' on the left and use a similar conditional.

Personal tools