Contact us Blog

Generating Address Labels

Apsona's document merge tool includes a feature for generating address labels via a suitably-structured .docx template. With this feature, you can (for example) create a report containing the contacts to whom to send thank-you letters, and generate both the thank-you letters and the address labels from that report, using two different merge actions.

Features

About address label templates

For the purposes of this tool, an address label template is just a .docx file containing a table and place-holder merge fields. You can start, for example, with any of the family of Avery Label Templates. If you start with an Avery or other canned template, the file will already have a table in it, and you just need to fill in the cells with the address fields as described below. You can also create your own label template with any logos, colors or font styles you need. If you are creating a new template other than a canned template, you will need to create a suitable table as described by the requirements below. In either case, you might find it useful to look at our macro for creating merge fields.

Requirements

The only requirements imposed on the template are the following.
  1. There should be a table in the template file, with at least two columns and two rows, representing the cells into which the labels will be generated.
  2. The top row of the table must contain the template merge fields, laid out in the format you want. The document generator will use this row as a "prototype" row to be filled with addresses and replicated as many times as necessary.
  3. In the top row, you can select one or more cells to contain addresses, and others to be empty, or contain logo images, or spacers, or whatever. Some examples:
    • You might use all the cells as address cells, without any spacers or logo images, as in the example below.
    • You might have narrow "spacer" cells between the address cells.
    • You might alternate cells containing addresses with cells containing logo images.
    The only requirement is that every cell that you wish to contain an address must have the same content, specifically, the same merge field names.

An example

Here is an example showing the steps to generate address labels from the Contact object. We will use the sample template file available here.
  1. Create the necessary Word template, and upload it to your Documents object in Salesforce. Below is a screen shot of the one we use in this example. Notice that the three address cells in the top row look identical, as specified in the requirements above. Notice also that there is a bit of styling, with different fonts and sizes for the Name and Address parts.
  2. Filter your data to produce the necessary Contact records, and click Tools - Merge/Mail to start up the merge tool. Select "Create and run a new merge action" and click the "Address labels" button. Then click "Next".
  3. Select the template you have created. Notice that in this step you can only generate a single .docx file. Click "Next".
  4. Set up the mapping of the merge fields in the template to the data fields from your data source. In this example, we are merging data from the Contact object. Click "Next".
  5. In the "Save this action as" box, provide a name for your new merge action. Click "Finish". When the "Download results" link appears, click it and dowload the results.
  6. Below is a screen shot of the resulting .docx file in our example.

Troubleshooting

The most common cause of errors in address label generation is disparities between the "prototype" content in the first row of the table template. So if you see invalid content being generated, or some columns being empty, the first step is to ensure that any "content" columns in the first row - i.e., columns containing template fields - have the exact same content. You can ensure this by copying the content of the first column and pasting it into the other columns in which you want address labels to appear.