Mail merging refers to automatically applying a database of details, such as names and addresses, to a document, so that many personalized copies are produced. It's ordinarily used to create form letters for mailings.
OpenOffice.org makes the procedure very easy, but it requires a source document containing the data that is to be merged into the document. Unlike with Microsoft Word, there's no way of entering this data within Writer itself.
Unless you have enough knowledge of databases to connect one to OpenOffice.org (the program works with dBase and MySQL files, among others), you may want to output existing data in the form of a comma-separated value (CSV) text file. You can then import this file into OpenOffice.org Calc and save it in the OpenOffice.org spreadsheet file format, which Writer's mail merge function works very well with. Alternatively, you can just enter the data in a new spreadsheet document. When creating a data source from scratch, create the data headings (such as Name, Street, City, and so on) along the top of the spreadsheet document, and enter the data itself beneath those headings, as shown in Figure 24-6.
Figure 24-6. You can quickly create mail merge data within a spreadsheet. Just make sure you create data headings at the top.
To mail merge this or any other kind of data within Writer, follow this general procedure (this example uses spreadsheet data):
Select Tools ®Mail Merge ®Other External Data Source. Then click Settings.
In the Database type drop-down list, select Spreadsheet. In the Data Source URL text box, enter the path to the spreadsheet. You can click the ellipsis button (…), and then browse to the data source file.
Click OK, and then click the Field Assignment button to assign your data fields, so that Writer knows which fields contain the data you want to use. Just click the drop-down lists and select the relevant data heading, as taken from the spreadsheet, so that the two match up. Note that there's no need to match every data field within this dialog box. It's perfectly acceptable to leave some blank if they're not relevant to your document.
Next, you'll be invited to type a name by which OpenOffice.org can identify the merge data in future. The default name is usually okay.
Click the Create button. You'll be returned to your document, which now has a new floating palette.
As you compose your document, you can click within the floating palette to expand the tree next to the data source you just created, and then double-click each of your data headings (on the page, these are known as merge fields) to insert them into your document at the cursor.
When you're ready to perform the merge, click OK in the floating palette.
If you want to simply send the documents straight to the printer, simply click OK in the merge dialog box that appears, as shown in Figure 24-7. However, if you want to save the merged document as a new file, click the File button, and then enter a path for the file and specify a filename. The file can be named automatically after a database field (which you can select in the relevant drop-down list) or named manually by typing the relevant entry in the Manual Setting text field.
Figure 24-7. The final mail merge stage is to create the personalized letters from the merged data.