OdsoDataSourceType

OdsoDataSourceType enumeration

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

public enum OdsoDataSourceType

Values

NameValueDescription
Text0Specifies that a given document has been connected to a text file. Possibly wdMergeSubTypeOther.
Database1Specifies that a given document has been connected to a database. Possibly wdMergeSubTypeAccess.
AddressBook2Specifies that a given document has been connected to an address book of contacts. Possibly wdMergeSubTypeOAL.
Document13Specifies that a given document has been connected to another document format supported by the producing application. Possibly wdMergeSubTypeOLEDBWord.
Document24Specifies that a given document has been connected to another document format supported by the producing application. Possibly wdMergeSubTypeWorks.
Native5Specifies that a given document has been connected to another document format native to the producing application. Possibly wdMergeSubTypeOLEDBText
Email6Specifies that a given document has been connected to an e-mail application. Possibly wdMergeSubTypeOutlook.
None7The type of the external data source is not specified. Possibly wdMergeSubTypeWord.
Legacy8Specifies that a given document has been connected to a legacy document format supported by the producing application Possibly wdMergeSubTypeWord2000.
Master9Specifies that a given document has been connected to a data source which aggregates other data sources.
Default7Equals 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 a mail merge with data from an Office Data Source Object.

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>");

// Create a data source in the form of an ASCII file, with the "|" character
// acting as the delimiter that separates columns. The first line contains the three columns' names,
// and each subsequent line is a row with their respective values.
string[] lines = { "FirstName|LastName|Message",
    "John|Doe|Hello! This message was created with Aspose Words mail merge." };
string dataSrcFilename = ArtifactsDir + "MailMerge.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());

// Opening this document in Microsoft Word will execute the mail merge before displaying the contents. 
doc.Save(ArtifactsDir + "MailMerge.MailMergeSettings.docx");

See Also