How to Use Mail Merge with AbiWord and KOffice

If you have read Solveig Haugland’s “Mail Merge in Openoffice.org: Everything You Need to Know,” then you already know how to use mail merge to reduce your workload in one free and open source software application (FOSS). However, OpenOffice.org is not the only FOSS application you can use for mail merge. You can also use AbiWord or KWord to get the same advantages.

Both AbiWord and KOffice were originally built for GNU/Linux, but both now have versions for Mac OS X and Windows as well. AbiWord is a standalone word processor, while KWord is part of KOffice, which started as an office suite for KDE, one of the most popular interfaces for GNU/Linux. Although neither AbiWord nor KWord has as many features of OpenOffice.org, both are developed enough for many users’ needs. Some people prefer them because they are smaller and faster than OpenOffice.org, and therefore run better on older and slower computers.

As you might know already from Haugland’s article, mail merge is not just about mail, although you can use it for email or paper letters. More accurately, mail merge is a feature that lets you create copies of a document that differ only in selected features. For instance, you might want to create copies of the same letter, but with different addresses and opening greetings. Or maybe you have a mass mail-out, and want to save yourself the trouble of re-typing hundreds of addresses that you already have in a list on envelopes. In some cases, mail merge can save you hundreds of hours of work while giving you professional-looking results.

The details of mail merges differ between applications, but in all of AbiWord, KWord, and OpenOffice.org, the general process is similar. In each application, you must:

  • Pick a source for the information that varies in the mail merge. Usually, this source is a spreadsheet or database.
  • Create the template document, with the text that will be the same in every copy, and placeholder fields to identify the information that varies.
  • Create the copies. Depending on the application, the copies may be in a single file, or have one file for each copy. Usually, you have the choice of printing the copies to file, or sending them directly to the printer.

If you remember this overview, then mail merges will be much simpler for you.

Mail merge with AbiWord

Mail merge in AbiWord is more limited than in KOffice (or OpenOffice.org). In fact, you have to leave the editing window to finish using it. However, even if you feel uneasy about using the command line, the steps are easy enough that you should have no trouble so long as you follow instructions.

One of the limitations of mail merge in AbiWord is that it can use fewer data sources than other word processors. In order to use mail merge in AbiWord, the information must be in a comma or tab-separated list, or in an XML file. Probably, you won’t have an XML file unless you work with formats like DocBook, so in practice you are limited to the other two choices. Fortunately, though, they are easy to create.

A comma separated list (which is a plain text file, often saved with a .csv extension for “comma separated values”) is just what it sounds like: A collection if information that is separated by commas. Basically, it is another way of organizing the sort of information that you find in the columns and rows of a spreadsheet. If you don’t have a comma separated list, you can easily create one. At times, that ease of creation may be an advantage, because you don’t have to know your way around databases or spreadsheets to use AbiWord.

Comma separated lists start list starts with a row with the names of fields. This row is the equivalent of column headings in a spreadsheet. For example, a first row might be:

FirstName,LastName,Company

Because you have this first row, you know the order of information in all the other rows. For example, the next two rows might be:

Herbert,West,ABC Corporation

Singh,Mohinder,Tag Express

Notice that, in all the rows, no space comes after a comma. In addition, the last entry does not have a comma after it, and, if a field is blank, then you need to add a second comma so that AbiWord reads the row correctly.

A tab-separated list follow the same rules, except that you use tab spaces to separate data instead of a comma. It has the advantage of being easier to read than a comma separate list, but, otherwise, the two types of lists are mostly identical.

Once you have the data source, design the template document, including the text that will not change. When you are ready to set up the fields for the changeable sections, go to Insert -> Mail Merge Field to add the placeholders. Click the Open File button to select the data source, and a list of fields (the values in the first row of the data source) become visible under Available Fields.

Available Fields

Moving the mouse cursor to the place in the template where you want to add the data, select an available field, then click Insert in the Insert Mail Field dialog window. Repeat this process as often as you need, and then save the document in AbiWord format Conveniently, the dialog window stays open until you specifically close it.

Mail merge data

Now, open a command line and enter a command based on this example:

AbiWord -m data-source file -p outputfile.ps/printer name template file

This command is simpler than it looks. The -m option identifies the data source, and -p the output file or the name of the printer to use, while the last file name identifies the template for the mail merge. The .ps extension for the output file creates a postscript file, saving the mail merge to a format that you can easily open later. If you use a printer name instead, you will not save the separate pages of the mail merge, although you can recreate them easily enough by running the same command again.

Mail merge with KWord

Mail merge in KWord is easier than it is in AbiWord – or, at least, you can complete the process without leaving the editing window. In addition, you can use a larger number of sources, including an SQL database (which is most of them, these days, including FOSS ones like MySQL and Postgres), a spreadsheet from KCalc (another program from KOffice), a KDE KAddress Book, or KWord’s built-in database. Since KWord’s native file format is Open Document, the same as OpenOffice.org’s, you can also use documents saved in OpenOffice.org.

Unless you are familiar with KDE or databases, your best choice of data sources is probably a KCalc sheet. It needs to be organized in the same way as a comma-separated list, with the first row giving field names, and one separate entry in each of the other rows. However, since you are adding information to spreadsheet cells, you do not need a comma or tab to separate out the different fields.

To start preparing the mail merge, select Tools -> Configure Mail Merge -> Open Existing to choose a data source. In the case of a KCalc spreadsheet or KAddress Book, choosing the data source simply requires you to locate the file on your hard drive, but using a database will require more information, as indicated in the dialog. You can find more information in The KWord Handbook that accompanies KWord.

To add the fields to the template, position the mouse and select Insert -> Variables -> Mail Merge. Inconveniently, the Mail Merge dialog closes each time that you select a field, but, even so, you should not take long to create the document.

KWord stores connections to data sources in the template document. You cannot see the complete document on screen, but you can see the copies from selecting File -> Print Preview. When you are ready, you can then print the mail merge the same as you would any other document by using File -> Print.

Conclusion

Mail merge can be confusing in any program, especially if only use it occasionally. However, if you keep the basic steps in mind – creating and identifying a data source, designing a template, and printing the copies – then you should have few problems.

Moreover, if you have learned to do mail merges in one application, you can probably learn quickly how to do them in other applications as well. If you are new to mail merges, you might appreciate that you are learning a task that is always very similar no matter what software you use. From this viewpoint, using AbiWord and KOffice are just different ways of doing the same task. The only differences are in the details, and the big picture remains the same.

by Bruce Byfield / January 2009

Visit Worldlabel.com and check out our large selection of Labels for laser and Inkjet

4 thoughts on “How to Use Mail Merge with AbiWord and KOffice

  1. Pingback: Posts about Open Source Software as of February 4, 2009

  2. Pingback: Pages tagged "gnu"

  3. Pingback: Worldlabel.com Blog » Printing Labels in Ubuntu

  4. Leon Stedman

    Abiword no longer works like this. The -p and –printer option has been removed. Mailmerge produces a series of file suffixed with -0, -1, -2 etc. and I can not find a way to pipe these to the printer as the abiword programmer suggest can be done. The only way is to use lpr -r *. The r switch will remove each file as it is printed.

Leave a Reply

Your email address will not be published. Required fields are marked *