Friday, February 12, 2010

Word File Data Merge

For a number of times, I was asked for a suggestion to Mail-Merge like Word file data merge problem. In stead of using Active Controls to open a Word template file, I always suggest to save the template file in text style, then it can be read and manipulated through placeholders defined in it and replaced with real data.

This way is simple and avoids the complexity and effort with ActiveX control. But the problem is that it loses images in the template word file when saved as html file format.

Images are important to produce formal and decent documents or reports.

Fortunately, xml file format works. When Word saves file as xml format, it embeds images inside the file as encoded binary data, while text data and font style are maintained in css and html style message.

It is the right format to use!

No comments: