Sets an collection as a data source to bind to a specified set of main document merge fields.

 public void SetDataSource(System.Collections.IEnumerator dataSource, System.String[] fieldNames, System.String dataSourceName)
Public Sub SetDataSource(ByVal dataSource As System.Collections.IEnumerator, ByVal fieldNames As String(), ByVal dataSourceName As String)

An IEnumerator collection to use as the data source.

A string array of data source field names. These must be the same as the corresponding merge field names in the template.

Specifies the data source name for the set of merge fields.

Save will throw this exception if null (C#) or Nothing (VB.NET) is passed to the method.

This method takes a collection of values and an array of field names. The two must contain the same number of elements. Each name in the array of field names must be the same as the corresponding merge field name in the template.

Each merge field in a WordWriter template must bind to a data source field/value pair. The number of merge fields in the main template document (the part of the document that is not within a repeat block) may not exceed the number of values in the data source defined by SetDataSource. However, the number of values in the data source may be greater than the number of merge fields in the main template document.


          wordTempl.SetDataSource(collValues, arrNames, "Products");
        

          wordTempl.SetDataSource(collValues, arrNames, "Products")