Using Mail Merge:

How to automate the distribution of a document to different destinations

Contents

Overview	ii

Copyright and trademark information	ii

Feedback	ii

Acknowledgments	ii

Modifications and updates	ii

Main Menu and Toolbars	1

What Mail Merge Means	1

Example: Sending a newsletter to a list of customers	2

Data Sources for Writer	2

Registering a Data Source	3

Practical Example of Mail Merge	4

Sequence of operations to do	4

Overview

This document is intended for first-time users of OpenOffice.org. In it, you will learn how to use the Mail Merge feature of Writer.

Practical examples show how to create a document containing fields of a database, and use the Mail Merge feature to create, or print multiple copies of the document, changing the content of the fields in each copy according to the corresponding records of the database.

Copyright and trademark information

The contents of this Documentation are subject to the Public Documentation License, Version 1.0 (the "License"); you may only use this Documentation if you comply with the terms of this License. A copy of the License is available at:
http://www.openoffice.org/licenses/PDL.rtf.

The Initial Writer of the Original Documentation is Vincenzo Ponzi. All Rights Reserved. (Initial Writer contact:vponzi@tiscalinet.it.)

Use the Initial Writer contacts to report errors in the documentation. For questions regarding how to use the software, subscribe to the Users Mail List and post your question there: http://support.openoffice.org/index.html.)

All trademarks within this guide belong to legitimate owners.

Feedback

Please direct any comments or suggestions about this document to:
dev@documentation.openoffice.org

Acknowledgments

Many thanks and congratulations to the developers who provided us with a great product! Thanks to the the community of authors, reviewers and support people for getting the project up and running. This is a great contribution for open software freedom.

Modifications and updates

Version	Date	Description of Change
1.0	3 January 2005	First published edition

Main Menu and Toolbars

In this document you will find references to Main Menu and various tool bars. The following figure references these objects, showing where they are located.

Figure 1. Location of menus and toolbars in OpenOffice.org Writer

What Mail Merge Means

OpenOffice.org Writer provides a very useful feature to create or print multiple copies of a document which must be sent to a list of different addresses.

The Writer document contains a mix of normal text and special text (fields) that reference the fields of a Data Source.

The Mail Merge function leaves the normal text unchanged, and replaces the fields with the data taken from the Data Source.

The following scenario illustrates how Mail Merge works.

Example: Sending a newsletter to a list of customers Imagine a business that needs to send a newsletter to all of its customers. There is already a Data Source containing the list of its customers with all the relative information: Address, Telephone, and so on. The secretary who writes the newsletter uses OpenOffice.org Writer. She writes the text of the newsletter, and instead of typing the destination address, inserts a field that references the address field in the Data Source. At last she starts the Mail Merge function to print as many copies of the document as the number of addresses contained in the Data Source. Each printed document contains the same text but a different customer name and address.

Data Sources for Writer

To obtain access to data contained in a Data Source, it is necessary to first register the Data Source with OpenOffice.org.

OpenOffice.org can register as a Data Source the following database types:

ODBC

MySQL

Adabas

dBase

ADO

Text

Spreadsheet

Address Book

Registering a Data Source

To register a Data Source with OpenOffice.org:

On the Main Menu, select Tools > Data Sources. Figure 2 shows the window that appears.

In the Name field, type the name that OpenOffice.org uses to identify the Data Source.

Select the Database type.

Type the URL (Uniform Resource Locater) of the Data Source.

Click on the New Data Source button in the window.

Figure 2. Registering a Data Source

Practical Example of Mail Merge

The best way to show how the Mail Merge function works is a practical example.

A mail order company organized a campaign to assign credit points to their customers according to the quantity of goods they buy during one year.

At the end of the year, they want to send a letter to each customer to show the total of credit points collected.

Sequence of operations to do

Step 1

Create a Data Source containing all the customers’ data.

The easiest way to do that is to create a spreadsheet with OpenOffice.org Calc as shown in Figure 3.

Figure 3. Creating a Data Source

The headings of the columns in the first row of the spreadsheet will be used as field names later.

The spreadsheet shown in Figure 3 is saved as: tab1.sxw.

Step 2

Register the spreadsheet to OpenOffice.org as described in “Registering a Data Source” on page 3.

Figure 4 shows that the spreadsheet is saved as Data source 1.

Figure 4. Registration of tab1.sxw

Data source 1 is a spreadsheet database containing the following fields:

Name – 2nd-name – Address – ZIP – Town – Ctry – Points – Telephone

After the registration, it is possible to use OpenOffice.org Writer to create documents that use the database as input.

Step 3

Use OpenOffice.org Writer to input the database fields in a document to be mailed to all (or a selection of) the names contained in Data Source 1.

In the top part of the document it is better to create a table with transparent borders to position correctly the text that is usually present in a letter (Date, Destination Address, etc.), and then the text as shown in Figure 5.

Figure 5. Example of using a table to position elements of a letter

Step 4

Insert the desired fields in the proper positions in the document.

To insert the current date:

Select the position where to insert the current Date.

On the main menu select: Insert>Fields>Date (see Figure 6).

Figure 6. Inserting the current date

To insert the other fields:

Select the position to insert the Name in the proper cell of the table (refer to Figure 5 on page 5).

Press Control+F2 (or select: Insert > Fields > Other on the Main Menu.

Double-click on “Data Source 1” and on “Sheet1” to display the window shown in Figure 7.
Figure 7. Display the fields in the database

Click on the “Name” field and then on the Insert button and press the Space bar.

Click on “2nd-name” and the Insert button and press Enter key to select a new line.

Click on “ZIP” and the Insert button and press the Space bar.

Click on “Address” and the Insert button and press Enter key to select a new line.

Click on “Town” and the Insert button and press the Space bar.

Type an open bracket “(”, click on “Ctry” and the Insert button, and type a close bracket “)”.

Select the point where to insert the Points field within the text, click on “Points” and the Insert button.

The result obtained so far is shown in Figure 8.

Figure 8. Name and address fields inserted in the proper position

Step 5

When all the required fields have been inserted, the document is ready for the Mail Merge function.

It is possible to start this function in two ways:

Select Tools>Mail Merge on the Main Menu.

Select File>Print on the Main Menu.

Figure 9 shows the messages that these methods produce.

Figure 9. Messages produced when starting Mail Merge

Clicking on OK in the first message, or Yes in the second, displays the window shown in Figure 10.

Figure 10. Mail Merge options

In this window you may specify which records to print:

All

Selected records (select the records first in the list of records)

From record number to record number.

If the selected output is Printer, Mail Merge starts to print as many documents there are records selected.

If the selected output is File, you must specify a path to a folder, where Mail Merge will create one file for each selected record.

The file names depend on the Database field that you select. For example, in Figure 10 the selected field is Name.

If there are multiple fields with the same content, a number is added to the filename.

For example:

The Name in the first record of the Database is Charlie; therefore the filename generated automatically by Mail Merge is Charlie0.sxw.

If there were more records with the same name, the generated files would have been: Charlie0, Charlie1, Charlie2, and so on.

Figure 11 shows the printout of the file Charlie0.sxw produced by Mail Merge.

Figure 11. Printout of the first letter

Practical Example of Mail Merge

Using Mail Merge	9

Title:	Using Mail Merge: How to automate the distribution of a document to different destinations
Version:	1.0
First edition:	January 2005
First English edition:	January 2005

Overview

Using Mail Merge: How to automate the distribution of a document to different destinations	ix

Using Mail Merge

Janet Swisher

2004-09-07T14:57:34