MailMergeMainDocumentType Enumeration |
Specifies the possible types for a mail merge source document.
Namespace:
Aspose.Words.Settings
Assembly:
Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntaxpublic enum MailMergeMainDocumentType
Public Enumeration MailMergeMainDocumentType
public enum class MailMergeMainDocumentType
type MailMergeMainDocumentType
Members
| Member name | Value | Description |
---|
| NotAMergeDocument | 0 |
This document is not a mail merge document.
|
| FormLetters | 1 |
Specifies that the mail merge source document is of the form letter type.
|
| MailingLabels | 2 |
Specifies that the mail merge source document is of the mailing label type.
|
| Envelopes | 4 |
Specifies that the mail merge source document is of the envelope type.
|
| Catalog | 8 |
Specifies that the mail merge source document is of the catalog type.
|
| Email | 16 |
Specifies that the mail merge source document is of the e-mail message type.
|
| Fax | 32 |
Specifies that the mail merge source document is of the fax type.
|
| Default | 0 |
Equals to NotAMergeDocument |
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