Zend certified PHP/Magento developer

How to mail merge using a table in the merged document

I was watching a presentation on document automation where I saw a guy run an operation that I am really struggling to replicate.

The document was set up in two parts: at the top was a table, and underneath that was a form letter.

The table had two columns.

  • In Column A, he had all the normal contact-information headers, e.g., “FirstName,” “LastName,” “Address,” etc.
  • In Column B, he entered the appropriate data for a customer into each of those fields.

Once he had finished entering data into the last row of the table, the table seemed to delete itself, and the letter populated with all the data he had entered into the table, generating a form letter addressed to the customer.

Unfortunately, at that point in the presentation he was just blazing through several different hacks he had worked out, and he didn’t explain how to do any of this. My assumption is that the letter was just set up as a normal mail-merge document, and that it was pulling its data from the fields in the table. I know how to make the table, and I know how to run a mail merge, but I can’t figure out how to tell mail merge to pull from an internal data source, rather than running out to Excel or Access.

Does anyone know how to do this?

(Bonus points if you know how to make the table self-destruct after completion. My best guess is that he just had a keyboard shortcut to a macro, but maybe there’s some other way?)