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
Afficher le fichier Open project: aspose-words/Aspose.Words-for-.NET

Méthodes publiques

Méthode 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 méthode

public GetChildDataSource ( string tableName ) : IMailMergeDataSource
tableName string
Résultat IMailMergeDataSource

GetValue() public méthode

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
Résultat bool

MoveNext() public méthode

Moves to the next record in the collection.
public MoveNext ( ) : bool
Résultat bool

MyMailMergeDataSource() public méthode

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.
Résultat Aspose.Words

MyMailMergeDataSource() public méthode

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.
Résultat Aspose.Words