Antenna House Office Servers Word API is a new Windows server product that makes it easy to merge data into form templates created with Microsoft Word. The tool makes it possible to automate the data merge process without installing Microsoft Office. It is still in the early production stages and has not been released, but there is a 30 day alpha test for those that want to try it out. Any feedback, feature suggestions, or questions after the evaluation are welcome.
You can use Command-line, .NET, Java, or C++ to complete the data merge process. Command-line interface is used in this tutorial.
First, design a template document created with Microsoft Word (.docx) that contains merge fields if you don't already have one. Here is the sample template (download) that is used for this tutorial.
Screenshot of sample Word template with merge fields
Also needed is a data set exported as a CSV or JSON file. Below is the sample data set (download).
Screenshot of sample data set
Store both files in the same folder and run a command-line program. Enter with the following command:
> cd [Install directory] > AHMailMergeCmd -i samples/score.docx -d samples/test_data.csv -f CSV -t Simple -o /tmp/ -n score_exe.docx
If the data merge for the Word document is successful, the following message will be displayed:
MailMergeCmd: Mail Merge finished normally, as shown above.
Screenshot of command-line window
A new Word document (.docx) will be created in the directory that was specified. Here is the new Word output (download) using the samples in this tutorial. There is a new page for each line of data from the data set.
Screenshot of new .docx file with merged data