Class MailMergeSettings
Represents the mail merge settings
Inheritance
System.Object
MailMergeSettings
Namespace: Syncfusion.DocIO.DLS
Assembly: Syncfusion.DocIO.UWP.dll
Syntax
public class MailMergeSettings : Object
Properties
DataSource
Gets or sets the data source file path.
Declaration
public string DataSource { get; set; }
Property Value
Type |
---|
System.String |
Examples
The following code example demonstrates change the datasource path in the mail merge setting in the document.
//Load an existing Word document into WordDocument instance.
WordDocument document = new WordDocument("Sample.docx", FormatType.Docx);
//Change the datasource property of the mail merge settings in the word document.
document.MailMerge.Settings.DataSource = "NewDataSource.txt";
//Saves the specified document
document.Save("Sample.docx", FormatType.Docx);
//Close the WordDocument instance
document.Close();
'Load an existing Word document into WordDocument instance
Dim document As New WordDocument("Sample.docx", FormatType.Docx)
'Change the datasource property of the mail merge settings in the word document
document.MailMerge.Settings.DataSource = "NewDataSource.txt"
'Saves the specified document
document.Save("Sample.docx", FormatType.Docx)
'Close the WordDocument instance
document.Close()
HasData
Gets a value indicating whether the document has mail merge settings or not.
Declaration
public bool HasData { get; }
Property Value
Type | Description |
---|---|
System.Boolean | True, if the document has mail merge settings. Otherwise false. |
Examples
The following code example demonstrates whether the document has mail merge settings or not.
//Load an existing Word document into WordDocument instance.
WordDocument document = new WordDocument("Sample.docx", FormatType.Docx);
//Removes the mail merge settings in the word document.
if (document.MailMerge.Settings.HasData)
document.MailMerge.Settings.RemoveData();
//Saves the specified document
document.Save("Sample.docx", FormatType.Docx);
//Close the WordDocument instance
document.Close();
'Load an existing Word document into WordDocument instance
Dim document As New WordDocument("Sample.docx", FormatType.Docx)
'Removes the mail merge settings in the word document.
If document.MailMerge.Settings.HasData Then
document.MailMerge.Settings.RemoveData()
End If
'Saves the specified document
document.Save("Sample.docx", FormatType.Docx)
'Close the WordDocument instance
document.Close()
Methods
RemoveData()
Removes the mail merge settings.
Declaration
public void RemoveData()
Remarks
Removes the mail merge settings, to convert a Word mail merge main document to a normal Word document. Hence the Microsoft Word application won't prompt to mail merge while opening this document.
Examples
The following code example demonstrates removes the mail merge setting in the document.
//Load an existing Word document into WordDocument instance.
WordDocument document = new WordDocument("Sample.docx", FormatType.Docx);
//Removes the mail merge settings in the word document.
if (document.MailMerge.Settings.HasData)
document.MailMerge.Settings.RemoveData();
//Saves the specified document
document.Save("Sample.docx", FormatType.Docx);
//Close the WordDocument instance
document.Close();
'Load an existing Word document into WordDocument instance
Dim document As New WordDocument("Sample.docx", FormatType.Docx)
'Removes the mail merge settings in the word document.
If document.MailMerge.Settings.HasData Then
document.MailMerge.Settings.RemoveData()
End If
'Saves the specified document
document.Save("Sample.docx", FormatType.Docx)
'Close the WordDocument instance
document.Close()