Question

I know there are heaps and heaps of threads out there on recommending and using OpenXML to manipulate a Word 2007 (docx) document.

But none I could find, have a practical example (full solution in zip) that I am able to try out and demonstrate to learn quickly how to use OpenXML. What I am after is a way to open a Word 2007 document template with several mailmerge fields, populate those fields from a dataset (SQL Server 2005) and save the template as a Word document ready to email.

  • UPDATE: We are using Visual Studio 2005 with .Net 2. Is that going to be a problem? Could we have .Net 3 installed but still use VS2005? Porting to VS2010 is in the cards for us, but not right now. We need a solution to this problem before we go upgrading to 2010.

And please do not recommend 3rd party products as we have to look for a free workable solution.

Much appreciate your time. Thanks

Was it helpful?

Solution

Here's an example.

It uses docx4j.NET - which is open source and which you can get from Nuget - not Microsoft's Open XML SDK.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top