Invoke.Docx
Download a trial version and give it a try!
Example: Quick start
In this example we will show you how to quickly create a template and merge data into that template using C#.
- Open Microsoft Word 2007, 2010 or 2013 and create a new word document
- Type in "Hello, %NAME%"
- Save the document
- Now open Visual Studio and create a new console application
- Add a reference to Invoke.Docx.dll
- Copy paste the code below into the main method
var sourceFile = "c:\path\to\your\template.docx"; var destinationFile = "c:\path\to\your\merged.docx"; File.Copy(sourceFile, destinationFile, true); DocumentDataSource dds = new DocumentDataSource(); dds["NAME"] = "World!"; DocumentRenderer.ProcessDocument(destinationFile, dds); Process.Start(destinationFile); - Run the console application
- When Word opens you'll see that %NAME% was replaced with "World!"