OdsoDataSourceType Enumeration

Specifies the type of the external data source to be connected to as part of the ODSO connection information.

Namespace:  Aspose.Words.Settings
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public enum OdsoDataSourceType
Members
  Member nameValueDescription
Text0 Specifies that a given document has been connected to a text file. Possibly wdMergeSubTypeOther.
Database1 Specifies that a given document has been connected to a database. Possibly wdMergeSubTypeAccess.
AddressBook2 Specifies that a given document has been connected to an address book of contacts. Possibly wdMergeSubTypeOAL.
Document13 Specifies that a given document has been connected to another document format supported by the producing application. Possibly wdMergeSubTypeOLEDBWord.
Document24 Specifies that a given document has been connected to another document format supported by the producing application. Possibly wdMergeSubTypeWorks.
Native5 Specifies that a given document has been connected to another document format native to the producing application. Possibly wdMergeSubTypeOLEDBText
Email6 Specifies that a given document has been connected to an e-mail application. Possibly wdMergeSubTypeOutlook.
None7 The type of the external data source is not specified. Possibly wdMergeSubTypeWord.
Legacy8 Specifies that a given document has been connected to a legacy document format supported by the producing application Possibly wdMergeSubTypeWord2000.
Master9 Specifies that a given document has been connected to a data source which aggregates other data sources.
Default7 Equals to None.
Remarks

The OOXML specification is very vague for this enum. I guess it might correspond to the WdMergeSubType enumeration http://msdn.microsoft.com/en-us/library/bb237801.aspx.

Examples
Shows how to execute an Office Data Source Object mail merge with MailMergeSettings.
// We'll create a simple document that will act as a destination for mail merge data
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>");

// Also we'll need a data source, in this case it will be an ASCII text file
// We can use any character we want as a delimiter, in this case we'll choose '|'
// The delimiter character is selected in the ODSO settings of mail merge settings
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);

// Set the data source, query and other things
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);

// Office Data Source Object settings
Odso odso = settings.Odso;
odso.DataSource = dataSrcFilename;
odso.DataSourceType = OdsoDataSourceType.Text;
odso.ColumnDelimiter = '|';
odso.FirstRowContainsColumnNames = true;

// ODSO/MailMergeSettings objects can also be cloned
Assert.AreNotSame(odso, odso.Clone());
Assert.AreNotSame(settings, settings.Clone());

// The mail merge will be performed when this document is opened 
doc.Save(ArtifactsDir + "Document.MailMergeSettings.docx");
See Also