Message-ID: <165704863.9713.1711699818416.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_9712_167903803.1711699818416" ------=_Part_9712_167903803.1711699818416 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html WordTemplate.SetDataSource(System.Collections.ICollection, Strin= g())

WordTemplate.SetDataSource(System.Collections.ICollection, String()= )

Description

=20

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

C#
=20
 public void SetDataSource(System.Collections.ICollection dataSource, Syste=
m.String[] fieldNames)
=20
=20
vb.net
=20
Public Sub SetDataSource(ByVal dataSource As System.Collections.ICollection=
, ByVal fieldNames As String())
=20
=20

Parameters

=20
dataSource
An=20 ICollection to use as the data source.=20
fieldNames
A string array of data source field names. T= hese must be the same as the corresponding merge field names in the templat= e.=20

Exceptions

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

Remarks

=20

This method takes a collection of values and an array of field names. Th= e two must contain the same number of elements. Each name in the array of f= ield names must be the same as the corresponding merge field name in the te= mplate.

=20

Each merge field in a WordWriter template must bind to a data source fie= ld/value pair. The number of merge fields in the main template document (th= e part of the document that is not within a repeat block) may not exceed th= e 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.

=20

Examples

=20
C#
=20

          wordTempl.SetDataSource(collValues, arrNames);
        
=20
=20
vb.net
=20

          wordTempl.SetDataSource(collValues, arrNames)
        
=20
------=_Part_9712_167903803.1711699818416--