MailMergeDestination Enumeration |
Specifies the possible results which may be generated when a mail merge is carried out on a document.
Namespace:
Aspose.Words.Settings
Assembly:
Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntaxpublic enum MailMergeDestination
Public Enumeration MailMergeDestination
public enum class MailMergeDestination
type MailMergeDestination
Members|
| Member name | Value | Description |
|---|
| NewDocument | 0 |
Specifies that conforming hosting applications shall generate new documents by populating the fields
within a given document with data from the specified external data source.
|
| Printer | 1 |
Specifies that conforming hosting applications shall print the documents that result from populating the
fields within a given document with external data from the specified external data source.
|
| Email | 2 |
Specifies that conforming hosting applications shall generate emails using the documents that result from
populating the fields within a given document with data from the specified external data source.
|
| Fax | 4 |
Specifies that conforming hosting applications shall generate faxes using the documents that result from
populating the fields within a given document with data from the specified external data source.
|
| Default | 0 |
Equals to the NewDocument value.
|
Remarks
ExamplesShows how to execute an Office Data Source Object mail merge with MailMergeSettings.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Write("Dear ");
builder.InsertField("MERGEFIELD FirstName", "<FirstName>");
builder.Write(" ");
builder.InsertField("MERGEFIELD LastName", "<LastName>");
builder.Writeln(": ");
builder.InsertField("MERGEFIELD Message", "<Message>");
string[] lines = { "FirstName|LastName|Message",
"John|Doe|Hello! This message was created with Aspose Words mail merge." };
string dataSrcFilename = ArtifactsDir + "Document.MailMergeSettings.DataSource.txt";
File.WriteAllLines(dataSrcFilename, lines);
MailMergeSettings settings = doc.MailMergeSettings;
settings.MainDocumentType = MailMergeMainDocumentType.MailingLabels;
settings.CheckErrors = MailMergeCheckErrors.Simulate;
settings.DataType = MailMergeDataType.Native;
settings.DataSource = dataSrcFilename;
settings.Query = "SELECT * FROM " + doc.MailMergeSettings.DataSource;
settings.LinkToQuery = true;
settings.ViewMergedData = true;
Assert.AreEqual(MailMergeDestination.Default, settings.Destination);
Assert.False(settings.DoNotSupressBlankLines);
Odso odso = settings.Odso;
odso.DataSource = dataSrcFilename;
odso.DataSourceType = OdsoDataSourceType.Text;
odso.ColumnDelimiter = '|';
odso.FirstRowContainsColumnNames = true;
Assert.AreNotSame(odso, odso.Clone());
Assert.AreNotSame(settings, settings.Clone());
doc.Save(ArtifactsDir + "Document.MailMergeSettings.docx");
See Also