Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This gist contains code snippets related to Mail Merge in MS Word template using Aspose.Words Cloud SDK for .NET
String MyClientID = "c235e685-1aab-4cda-a95b-54afd63eb87f"; // Get MyClientID from https://dashboard.aspose.cloud/
String MyClientSecret = "b8da4ee37494f2ef8da3c727f3a0acb9"; // Get MyClientSecret from https://dashboard.aspose.cloud/
// crate an instance of Configuration class and provide your personalized Client ID and Client Secret details
var config = new Configuration { ClientId = MyClientID, ClientSecret = MyClientSecret };
// initialize WordsAPI object using Configuration instance
var wordsApi = new WordsApi(config);
// first input document
string inputDocument = "SampleMailMergeTemplate.docx";
string inputDataFile = "SampleMailMergeTemplateData.txt";
// name of resultant file
string resultantFile = "TestPostDocumentExecuteMailMerge.docx";
// read the content of data file
string data = File.ReadAllText("/Downloads/" + inputDataFile, System.Text.Encoding.UTF8);
// Create ExecuteMailMergeRequest object by providing input file, data file and resultant output details
Requests.ExecuteMailMergeRequest request = new Requests.ExecuteMailMergeRequest(inputDocument, data, null, null, null, null, null, null, null, null, resultantFile);
// perform the mail merge operation
DocumentResponse result = wordsApi.ExecuteMailMerge(request);
This gist contains code snippets related to performing Mail Merge operation on MS word template using Aspose.Words Cloud SDK for .NET
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment