MailMergeSettingsActiveRecord Property

Specifies the one-based index of the record from the data source which shall be displayed in Microsoft Word. The default value is 1.

Namespace:  Aspose.Words.Settings
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public int ActiveRecord { get; set; }

Property Value

Type: Int32
Examples
Shows how to execute a mail merge while connecting to an external data source.
Document doc = new Document(MyDir + "Odso data.docx");

MailMergeSettings settings = doc.MailMergeSettings;

Console.WriteLine($"Connection string:\n\t{settings.ConnectString}");
Console.WriteLine($"Mail merge docs as attachment:\n\t{settings.MailAsAttachment}");
Console.WriteLine($"Mail merge doc e-mail subject:\n\t{settings.MailSubject}");
Console.WriteLine($"Column that contains e-mail addresses:\n\t{settings.AddressFieldName}");
Console.WriteLine($"Active record:\n\t{settings.ActiveRecord}");

Odso odso = settings.Odso;

Console.WriteLine($"File will connect to data source located in:\n\t\"{odso.DataSource}\"");
Console.WriteLine($"Source type:\n\t{odso.DataSourceType}");
Console.WriteLine($"UDL connection string string:\n\t{odso.UdlConnectString}");
Console.WriteLine($"Table:\n\t{odso.TableName}");
Console.WriteLine($"Query:\n\t{doc.MailMergeSettings.Query}");

// We can clear the settings, which will take place during saving
settings.Clear();

doc.Save(ArtifactsDir + "Document.OdsoEmail.docx");

doc = new Document(ArtifactsDir + "Document.OdsoEmail.docx");
Assert.That(doc.MailMergeSettings.ConnectString, Is.Empty);
See Also