HOWTO: Mail Merge with OpenOffice.org
A few people have mentioned that one of the more popular questions floating around these days is how to do a mail merge with OpenOffice.org v2.0 (OOo).
On this week’s upcoming GNU/Linux User Show (#26) we will cover this off in more detail in real time, but to get things started, here’s a quick look at how to do some rudimentary merging. For the uninitiated, a mail merge is the cool 21st century name for a ‘form letter’. Most office suites these days allow the insertion of customized fields into a standardized document to create many like documents, but with distinct information in each. A good example of a mail merge is the promotional letters that you may receive in the mail from your credit card company. Everyone gets the same letter, but each one has the recipient’s own name and address on it.

The first thing you need in order to do a mail merge is some data to merge. I’ve set up a simple-stupid OOo Calc spreadsheet with three simple addresses in it. The idea is that each of these addresses is going to be its own letter by the time we’re done. In this particular example, we’re not going to get all fancy and insert data within the document itself, rather we’re going to make a form letter and just make a copy for each addressee with their own address at the top.

Now that I have my addresses, I want to fire up OOo Write. I have two choices here: I can type the body of the document and then add the addresses, or I can add the addresses and then put the text in. I’m going to opt for number two. In a rather tragic turn of events, the Prime Minister of Nigeria has just passed away and I, as the Secretariat General, have been entrusted with his remains. Unfortunately, there is no money in the national coffers so I have to ask good hearted souls for money.
First things first. Put in the addresses:
Once I have my blank document open, click on Tools -> Mail Merge Wizard. I’m going to use Start with the Current Document and click Next.
I’m going to create Letters (which is the default) rather than emails on the next screen, so I’m just going to click Next here.

The next screen bears some attention. This is where I tell OOo to get the addresses from. If you haven’t done a mail merge before, then it’s likely that the address blocks are greyed out. They will remain so until you select an address list. To do so, click the Select Different Address List button. I already have an address list created, so I’m going to click the Add button, and browse to my address.ods file and select it.
If you look at the top address block, you will see the fields that OOo will display in the finished document. I know that I want my Address2 line to display (because that will become my Street Name field in a minute), but Address2 doesn’t show up in either of the two examples I have to chose from. I need to add it. To do this, click the More button to open the Address Block Window.
Oh my God - NONE of the samples have the Address2 field in them. I better add it in. Select the address block that most closely matches what you want and click the Edit button.
I select the Address2 field from the list of fields on the right and use the right-pointing arrow to move it into the address block. I then use the up/down/left/right arrows on the right of the window to position the field where I want it. Perfect. Click OK and you’re back at the address block window.

Here’s where things get interesting. OOo will attempt to match the names of the fields in my address book to the names of the fields it is expecting. The fields that match properly (such as Title and Title) will show up in the address data block (lower block). If you have any fields that don’t match exactly, you’ll have to map them.
Note that in my Calc sheet I have fields named Street Number and Street Name. These won’t match anything in the Mail Merge wizard because it’s expecting Address1 and Address2. In order to make my Street Number and Street Name appear in the address box, I have to map them to Address1 and Address2. Click the Match Fields button to accomplish this.

Select the field that you map to Address1 from the drop down list box beside the Address1 label. In my case, I select Street Number from the drop down list beside Address1 and Street Name from the drop down list beside Address2. Click OK and we’re back at the address block window.
Click Next to move along.

The next screen allows me to set the salutation options: whether to have one at all, what it should say, what field to use to signal OOo that the recipient is female, and what salutation to use for females. I’ve shut the salutation off altogether because I can’t get it to work right. If you look at the screen shot, you can see both Mr and Mrs Watson in the preview window (greyed out). I can’t seem to get OOo to just put one salutation in and I don’t want both.
I clicked Next.
The next screen allows me to position my address block on the screen by setting the centimeter distance from the top of the page. There’s a little preview window so I click away until I’m happy with where it is.
Click Next.
I can now preview my documents (their hiding behind the wizard window, but I can minimize the wizard to take a look at them). This is also the point where I am going to add my text to the letter. Clicking the Edit Document button allows me to do this. While I type my message into the document, there’s a little button that floats around labelled Return to Mail Merge Wizard. Once I’ve entered my text, I’m going to click that button.
Good Evening.
It is with great pleasure that I am making your acquaintance but it is under the most unpleasantness of circumstances. Enola Nola, the Prime Minister of Nigeria has just passed away and I, Lego Land as the Secretariat General, have been entrusted with his remains. It is with great unfortunateness that I must tell you that there is no money in the national bank for such burial…
Now that I’ve returned to the Wizard, I click the Next button. I can now edit each individual document if I have a need to either by hand or by using the search function on this window. I’m not interested in that, so I click Next.

I am now presented with the option to save each letter as an individual document, or to save or print the merged document. I want to save each individual document, for a total of three, so I select the Save Merged Document option. More options open up below to give me the option to save the merged document as a single, multi-page document, or as three individual documents. I’m choosing the latter and then pressing the Save Documents button. A quick dialogue box asking me for a name and location, and presto! Three Nigerian spam letters ready to go!
The Wizard’s Finish button will activate once the documents are saved and clicking it will return me to my original document. I close it, because I’ve got three good ones saved elsewhere and off I go to make my millions.
Again, this is the most rudimentary of mail merges, but it serves to get into the tools and Wizard to muck around and perhaps learn a little more.
Happy merging, and stay tuned to this week’s GNU/Linux User Show for more information.
Related Stories
POSTED IN: How To
0 opinions for HOWTO: Mail Merge with OpenOffice.org
No one has left a comment yet. You know what this means, right? You could be first!
Have an opinion? Leave a comment: