I’m starting to get old. How do I know this? Well, one way is that I remember with fondness mail merges in WordPerfect. Ah, but we don’t use WordPerfect any longer. We use Word. Word has a perverse mail merge system. I have no idea how office admins (whom I assume are the target market for this feature), learn how to use this system efficiently. My hat is off to them.
Some years ago, in an effort to save money, I inherited the task of creating an electronic face book of our students. It shows some basic information:
- A photo (if we have one)
- The student’s name
- Their undergraduate institution
- Their major(s)
- Their graduate institution, if any, along with graduate degree earned, as well as area of graduate study
- Their permanent city and state
I have produced this both in gridded form and row form for some time.
To generate these, I’ve used the fantastic ReportLab Python PDF library, and I’ve also used Pentaho’s Report Designer. The backend data is stored in a spreadsheet and/or a database table. The issue, of course, is that I’ve never turned this service back into a turn-key offering that could be handed off to someone else. This is the curse of the small shop (or the unskilled coder). You have enough time to write 60% of what you need to write – enough to get the job done and enough to get some kudos on the first iteration of the product.
However, you now own what was essentially an administrative task and one that would have been done with glue and scissors 20 years ago and would not have required IT intervention. So, I started looking at MS mail merge, because I thought, how hard could it be? Right? Perhaps that would be a way to hand off this task to someone else. Geez.
Here’s a screen capture of what the merge codes might look like to load up one entry:
Really? This is what is required for an admin to come up with a reasonably basic entry that includes a picture based on the value in a field and also deals with missing data reasonably well. There are lots of neat nested expressions. Whitespace is significant to printing, as well, so you’ll need to triple check that. Note that I haven’t yet dared to tackle blank lines generated by the absence of grad-school data. It gets better… If you load up a label template with all of this code, you will not be able to see the bottom parts of it. You will also need to deal with a cryptic wizard or two along the way.
Here are some references that helped me get this far:
- Word Mail Merge: It’s not Just for Letters (from 2007, Windows-oriented, has various useful tid-bits)
- Office 2010 Don’t print blank lines when data fields are empty (includes this heart-felt comment: “I’m sorry but this is a bunch of crap…”)
- Bringing in an local image in mail merge
- How to include pictures in a Microsoft Word Mail Merge
- Background on colon-delimited paths vs Unix-style paths (you’ll note that the above snippet uses old-style colon-delimited paths. This seems to be required.)
As for me, I think I’ll go back to updating the Python script that creates these. Once again, I tip my hat to the people who have to use MS mail merge every day. Perhaps this set of links will be helpful – also, of course, I could just be a complete ignoramus when it comes to this stuff. Any tips are most appreciated. Feel free to share in the comments.