{"id":23060824,"url":"https://github.com/syncfusionexamples/mail-merge-in-word-processor","last_synced_at":"2025-08-23T03:45:16.322Z","repository":{"id":61349603,"uuid":"527407050","full_name":"SyncfusionExamples/mail-merge-in-word-processor","owner":"SyncfusionExamples","description":"This demo illustrates how to create template Word document and generate reports like invoice using mail merge in Syncfusion Word processor within your Web application.","archived":false,"fork":false,"pushed_at":"2024-12-04T05:47:46.000Z","size":1303,"stargazers_count":2,"open_issues_count":1,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-07-16T05:12:40.921Z","etag":null,"topics":["document-editor","mail-merge","word-processing-document-api","word-processor"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SyncfusionExamples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-22T04:11:19.000Z","updated_at":"2024-12-04T05:47:46.000Z","dependencies_parsed_at":"2024-09-17T11:20:45.244Z","dependency_job_id":"faed32ff-5289-42c0-88d1-95cbdb52569e","html_url":"https://github.com/SyncfusionExamples/mail-merge-in-word-processor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/SyncfusionExamples/mail-merge-in-word-processor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SyncfusionExamples%2Fmail-merge-in-word-processor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SyncfusionExamples%2Fmail-merge-in-word-processor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SyncfusionExamples%2Fmail-merge-in-word-processor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SyncfusionExamples%2Fmail-merge-in-word-processor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SyncfusionExamples","download_url":"https://codeload.github.com/SyncfusionExamples/mail-merge-in-word-processor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SyncfusionExamples%2Fmail-merge-in-word-processor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271739883,"owners_count":24812636,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-23T02:00:09.327Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["document-editor","mail-merge","word-processing-document-api","word-processor"],"created_at":"2024-12-16T03:15:24.112Z","updated_at":"2025-08-23T03:45:16.287Z","avatar_url":"https://github.com/SyncfusionExamples.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mail merge in Word processor\nThis demo illustrates how to create template Word document and generate reports like invoice using mail merge in Syncfusion\u0026reg; Word processor (a.k.a.) Document editor within your Web application.\n\n## Demo illustration\n\n### Insert Merge Field\n\nYou can insert the merge field in Documenteditor using the **Select Field to Insert** pane in left side or **Insert Field** options in toolbar.\n* **Select Field to Insert** pane: \n    * It allows you to insert the field by drag/drop or clicking on the field which will insert the field at current position. \n    * The list of field which displayed in pane is retrieved from \"wwwroot/script/Data/Employees.json\" file.\n    * You can change the field based on your requirement by opening the json file using **Choose File** options in **Select Field to Insert** pane.\n* **Insert Field** options:\n    * By clicking this options, **Merge Field** dialog will open. You can add the required field to insert it in current position.\n\nThe following code snippet is used to insert the field in Document editor:\n\n```javascript\nvar fieldName = \"Employees\";\n\ncontainer.documentEditor.editor.insertField('MERGEFIELD ' + fieldName + ' \\\\* MERGEFORMAT');\n```\n\n### Perform Mail Merge\n\nIn this demo, you can preview the mail merge results (View the merged the document) in Document editor.\n\n#### Preview Results\n\nIn toolbar, by choosing the **Preview Results** options in **Mail Merge** dropdown, you can preview the result document. By clicking this options, the following options will show in title bar.\n\n![image](preview.png)\n\n* You can navigate between the records by using the arrows.\n* \"Exit preview\" helps to get out of preview option.\n\n#### Merge \u0026 Finish\n\nIn toolbar, by choosing the **Merge \u0026 Finish** options in **Mail Merge** dropdown, you can generate report as single document for all records with page inserted after each record. Then the generated document is viewed in Document editor.\n\nThe following process takes place:\n* Document editor export the current document as base64string using saveAsBlob API.\n* Then send the base64string to server for performing mail merge. \n* In server side(MailMergeReport API in DocumentEditorController file), with the help of [`Syncfusion\u0026reg; DocIO`](https://help.syncfusion.com/file-formats/docio/working-with-mail-merge) performs mail merge.\n* Finally, send the SFDT content to client side for opening it in Document editor.\n\nThe following code snippet is used to perform mail merge.\n\n```c#\nSyncfusion.DocIO.DLS.WordDocument document = new Syncfusion.DocIO.DLS.WordDocument(stream, Syncfusion.DocIO.FormatType.Docx);\nstream.Dispose();\ndocument.ExecuteMailMerge(exportData.mergeData);\nSyncfusion.EJ2.DocumentEditor.WordDocument wordDocument = Syncfusion.EJ2.DocumentEditor.WordDocument.Load(document);\nstring sfdtText = Newtonsoft.Json.JsonConvert.SerializeObject(wordDocument);\nwordDocument.Dispose();\nreturn sfdtText;\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyncfusionexamples%2Fmail-merge-in-word-processor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyncfusionexamples%2Fmail-merge-in-word-processor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyncfusionexamples%2Fmail-merge-in-word-processor/lists"}