Message-ID: <795533299.8171.1711635272087.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_8170_1780694213.1711635272087" ------=_Part_8170_1780694213.1711635272087 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
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 m= erge fields.
=20public void SetDataSource(System.Object[] dataRow, System.String[] fieldNa= mes, System.String name)=20
Public Sub SetDataSource(ByVal dataRow As Object(), ByVal fieldNames As Str= ing(), ByVal name As String)=20
null
(C#) or=20
Nothing
(VB.NET) is passed to the method.=20
The method's third parameter - name
- specifies the data so=
urce name for the set of merge fields. For example, if the main document co=
ntains the following sets of merge fields:
«Customer.FirstName» | =20
«Order.OrderId» | =20
«Customer.LastName» | =20
«Order.Date» | =20
For the first set of merge fields, set name
to "Custo=
mer," and for the second, set name
to "Order."<=
/p>=20
Se= tDataSource 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 fie= ld name in the template.
=20Each merge field in a WordWriter template must bind to a data source fie=
ld/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 i=
n the data source defined by SetDataSource
. However, the numbe=
r of values in the data source may be greater than the number of merge fiel=
ds in the set.
This method may be called once for each set of merge fields in the main = document.
=20//--- Create a string array of field names. //--- The field names must be the same as the merge field //--- names in the template. string[] arrFields =3D {"CompanyName", "StreetAddr", "City", "State", "ZipCode"}; //--- Create an object array of values //--- Ordinal numbers match those of the fields array object[] arrValues =3D {"SoftArtisans", "1330 Beacon Street", "Brookline", "MA", "02446"}; oWW.SetDataSource(arrValues, arrFields, "data");=20
'--- Create a string array of field names. '--- The field names must be the same as the merge field '--- names in the template. Dim arrFields As String() =3D {"CompanyName", _ "StreetAddr", _ "City", _ "State", _ "ZipCode"} '--- Create an object array of values '--- Ordinal numbers match those of the fields array Dim arrValues As Object() =3D {"SoftArtisans", _ "1330 Beacon Street", _ "Brookline", _ "MA", _ "02446"} oWW.SetDataSource(arrValues, arrFields, "data")=20