DocumentCoreMailMerge Property |
Gets a
MailMerge object that represents the mail merge functionality for the document.
Namespace: SautinSoft.DocumentAssembly: SautinSoft.Document (in SautinSoft.Document.dll) Version: 2025.4.25
Syntaxpublic MailMerge MailMerge { get; }
Public ReadOnly Property MailMerge As MailMerge
Get
Property Value
MailMerge
Remarks
ExampleGenerates 5 envelopes 'Happy New Year' for Simpson family using the one template using C#
using System;
using System.IO;
using SautinSoft.Document;
namespace Sample
{
class Sample
{
static void Main(string[] args)
{
MailMergeSimpleEnvelope();
}
public static void MailMergeSimpleEnvelope()
{
string templatePath = @"..\..\..\envelope-template.docx";
string resultPath = "Simpson-family.docx";
DocumentCore dc = DocumentCore.Load(templatePath);
var dataSource = new[] { new { Name = "Homer", FamilyName = "Simpson" },
new { Name = "Marge ", FamilyName = "Simpson" },
new { Name = "Bart", FamilyName = "Simpson" },
new { Name = "Lisa", FamilyName = "Simpson" },
new { Name = "Maggie", FamilyName = "Simpson" }};
dc.MailMerge.Execute(dataSource);
dc.Save(resultPath);
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(resultPath) { UseShellExecute = true });
}
}
}
Generates 5 envelopes 'Happy New Year' for Simpson family using the one template using VB.Net
Option Infer On
Imports System
Imports System.IO
Imports SautinSoft.Document
Module Sample
Sub Main()
MailMergeSimpleEnvelope()
End Sub
Sub MailMergeSimpleEnvelope()
Dim templatePath As String = "..\..\..\envelope-template.docx"
Dim resultPath As String = "Simpson-family.docx"
Dim dc As DocumentCore = DocumentCore.Load(templatePath)
Dim dataSource = {
New With {
Key .Name = "Homer",
Key .FamilyName = "Simpson"
},
New With {
Key .Name = "Marge ",
Key .FamilyName = "Simpson"
},
New With {
Key .Name = "Bart",
Key .FamilyName = "Simpson"
},
New With {
Key .Name = "Lisa",
Key .FamilyName = "Simpson"
},
New With {
Key .Name = "Maggie",
Key .FamilyName = "Simpson"
}
}
dc.MailMerge.Execute(dataSource)
dc.Save(resultPath)
System.Diagnostics.Process.Start(New System.Diagnostics.ProcessStartInfo(resultPath) With {.UseShellExecute = True})
End Sub
End Module
See Also