Page tree
Skip to end of metadata
Go to start of metadata

Description

Sets a main document data source to a one-dimensional object array. The method imports a single row of data to the specified set of main document merge fields.

C#
vb.net

Parameters

data
An object array of values to use as a data source. WordWriter will insert these values in the template's merge fields.
fieldNames
A string array of data source field names. These must be the same as the corresponding merge field names in the template
name
A string that matches the data source name.

Exceptions

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

Remarks

The method's third parameter - name - specifies the data source name for the set of merge fields. For example, if the main document contains the following sets of merge fields:

«Customer.FirstName»

«Order.OrderId»

«Customer.LastName»

«Order.Date»

For the first set of merge fields, set name to "Customer," and for the second, set name to "Order."

SetDataSource takes an object array of values and a string array of field names. The two arrays 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 a set (merge fields that share the same data source name or number) 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 set.

This method may be called once for each set of merge fields in the main document.

Examples

C#
vb.net
  • No labels