OpenOffice Mail Merge
Summary
Create a spreadsheet with names, addresses etc…, create a database file linked to the spreadsheet, and then create envelopes or letters (the template) to specified recipients from the database. What follows is a manual method for setting up the database. You may also use the Mail Merge Wizard, but what follows offers more control and a better understanding of what is happening.
Create the Spreadsheet
create a new spreadsheet file
label the top row of each column for the data you will input below (i.e.: last name, first name, address 1, etc…)
input each person as desired in the rows below
(optional) you may wish to filter recipients based on specific criteria
create extra columns for codes, or holidays such as Easter, Thanksgiving, and Christmas
if you create columns with names instead of using codes, put an x or similar identifier in each corresponding column if you want that person to be included in that list
save the file and note the name and location for the next step
Create a Database file (link) to the Spreadsheet
* You may also use Tools → Mail Merge Wizard to automatically create the database
create a new database file
in the database wizard, select “Connect to an existing database”, “Spreadsheet”, and click Next
browse for the spreadsheet file you just created, and click Open, then Next
select 'Yes, register the database for me“
uncheck “Open the database for editing”
click Finish, and save the database file (doesn't matter where, but probably put it in the same folder as the spreadsheet)
Add the Database to OpenOffice
Option 1 - automatically added
Option 2 - add using options
open the Options dialog: Tools → Options (Preferences on the Mac)
OpenOffice Base → Databases
New
Browse… for database file (.odb)
Click Open, OK, OK
Create the template document
* The template can be an envelope, letter, or anything else where you select individual fields from your database and orient them wherever you like, with formatting and fonts.
Envelopes
create a new Text Document
Insert → Envelope…
Click the Printer tab
select the appropriate feed direction for your printer
Click the Format tab
select the proper envelope under Size → Format, or enter a custom size
position the Addressee / Sender accordingly
Click the Envelope tab
select your database from the Database drop down menu
select your sheet name (probably Sheet1)
select a desired Database Field
click the arrow to add the field to your Addressee block
type enter after the field you just added, or do whatever you like to format it accordingly
add other fields as desired, while typing commas or other things when necessary
type your address in the sender box
Click New Doc. to create a new document with the proper information
save the envelope template document (suggestion: same folder as spreadsheet, Example: “Envelope - No 10.odt”)
Letters
create a letter as desired, until you get to the point where you want recipient data to appear (addresses, salutations,e etc…)
View → Data Sources
expand your database until you get to <database name> → Tables → Sheet1 (or whatever your sheet is called)
when you click your sheet, you should see a listing of your columns
click and drag from the column heading of your choice into your main document, where you want this data to appear
press return or format accordingly
drag another column heading into your document, as desired
when you are finished dragging columns, close the Data Sources dialog (View → Data Sources, or use the toolbar button)
save your letter template document (suggestion: same folder as spreadsheet, Example: “Letter - Easter.odt”
Printing
if you have any trouble getting your printer to cooperate, you can also try making a letter size template and positioning the fields in the right place for your printer; typically this would be to make a landscape oriented letter size document
it may be easier to save the document to a pdf instead of actually printing it so you can send the pages you want to the printer as many times as you need in case of feed issues, etc…
with your envelope or letter template open, File → Print
on the dialog asking if you want to print a form letter, click “Yes” (DO NOT CHECK THE WARNING BOX! See form letter warning section below if you messed this up)
if you are presented with a dialog asking if you want to print field names, click No
(optional - filtering) when presented with columns of your data, click on a cell that has a distinguishing characteristic of your choice, such as a cell with an “x” in an Easter column, or a specific code, and click the “AutoFilter” button
your records should be filtered based on each row having the same content that was in the cell you just filtered
if you make a mistake, you can click the “Remove Filter/Sort” button to reset everything
click Print
follow your normal print dialogs accordingly
If you made the BIG mistake of checking the “Do not show warning again” box when printing, you need do the following:
close OpenOffice
find your user preferences
edit the file user/registry/data/org/openoffice/Office/Writer.xcu in a text editor, such as TextWrangler (Mac) or Crimson Text Editor (Windows)
find the section with <prop oor:name=“AskForMerge”>, find the “false” text and change it to “true”
save the file
OpenOffice should now present you with this warning dialog again
-
Advanced Fields
As good as the above functionality is, it may not be enough to suite your needs. Perhaps you have address 1, and address 2, but you don't want a blank space to appear when no address 2 exists. Maybe you don't have an address to print out, and you want to hand deliver to certain people. These situations require advanced fields in OpenOffice.
Hidden Paragraphs
If you don't want a line break after address 1, when no address 2 exists, you must add a “Hidden Paragraph” designator after your address 2 field.
move your cursor after the address 2 field
Insert → Fields → Other
click the Functions tab
click the “Hidden Paragraph” type
in the Condition Field, type the following:
(this is specific to our list, and yours may differ according to database name or file name)
![Addresses0.Sheet1.Address 2]
! means “if there is nothing in this field”, Addresses0 is our database name, Sheet1 is the sheet name, and Address 2 is the field (column)
if we don't have anything in Address 2, there won't be a blank line after Address 1
click insert
do the same AFTER any field you wish
Hidden Text
You may want to hide things based on conditions. If you are hand delivering to certain recipients, you may not have an address in the file for them. In this case, you wouldn't want the comma to appear between the city and state.
DO NOT type a comma and space between the city and state fields
if you already have a comma and space, delete them so that the city and state fields are touching
move your cursor between the city and state
Insert → Fields → Other
click the Functions tab
click the “Hidden Text” type
in the Condition Field, type the following:
(this is specific to our list, and yours may differ according to database name or file name)
![Addresses0.Sheet1.City]
! means “if there is nothing in this field”, Addresses0 is our database name, Sheet1 is the sheet name, and City is the field (column)
if we don't have anything in the city, the comma and space will not print
click insert
do the same for any text you need to control visibility with