C# Class Aspose.Words.Examples.CSharp.Mail_Merge.LINQtoXMLMailMerge.MyMailMergeDataSource

Aspose.Words does not accept LINQ queries as an input for mail merge directly, But provides a generic mechanism which allows mail merges from any data source. This class is a simple implementation of the Aspose.Words custom mail merge data source Interface that accepts a LINQ query (in fact any IEnumerable object). Aspose.Words calls this class during the mail merge to retrieve the data.
Inheritance: IMailMergeDataSource
Show file Open project: aspose-words/Aspose.Words-for-.NET

Public Methods

Method Description
GetChildDataSource ( string tableName ) : IMailMergeDataSource
GetValue ( string fieldName, object &fieldValue ) : bool

Aspose.Words calls this method to get a value for every data field. This is a simple "generic" implementation of a data source that can work over Any IEnumerable collection. This implementation assumes that the merge field Name in the document matches the name of a public property on the object In the collection and uses reflection to get the value of the property.

MoveNext ( ) : bool

Moves to the next record in the collection.

MyMailMergeDataSource ( IEnumerable data ) : Aspose.Words

Creates a new instance of a custom mail merge data source.

MyMailMergeDataSource ( IEnumerable data, string tableName ) : Aspose.Words

Creates a new instance of a custom mail merge data source, for mail merge with regions.

Method Details

GetChildDataSource() public method

public GetChildDataSource ( string tableName ) : IMailMergeDataSource
tableName string
return IMailMergeDataSource

GetValue() public method

Aspose.Words calls this method to get a value for every data field. This is a simple "generic" implementation of a data source that can work over Any IEnumerable collection. This implementation assumes that the merge field Name in the document matches the name of a public property on the object In the collection and uses reflection to get the value of the property.
public GetValue ( string fieldName, object &fieldValue ) : bool
fieldName string
fieldValue object
return bool

MoveNext() public method

Moves to the next record in the collection.
public MoveNext ( ) : bool
return bool

MyMailMergeDataSource() public method

Creates a new instance of a custom mail merge data source.
public MyMailMergeDataSource ( IEnumerable data ) : Aspose.Words
data IEnumerable Data returned from a LINQ query.
return Aspose.Words

MyMailMergeDataSource() public method

Creates a new instance of a custom mail merge data source, for mail merge with regions.
public MyMailMergeDataSource ( IEnumerable data, string tableName ) : Aspose.Words
data IEnumerable Data returned from a LINQ query.
tableName string Name of the data source is only used when you perform mail merge with regions. /// If you prefer to use the simple mail merge then use constructor with one parameter.
return Aspose.Words