Message-ID: <521436705.8425.1711645812636.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_8424_1964287948.1711645812636" ------=_Part_8424_1964287948.1711645812636 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Table of Contents |
---|
In a WordWriter template, a merge field displays a data source field (fo= r example, a database column name) where a data source value will be insert= ed. A template may include merge fields in repeat blocks, merge fields in t= he main document, or both. A repeat block is a text fragment, a list, or a = table row in the template document, defined by a Word bookmark, that contai= ns merge fields. The main document is any part of the template that is not = within a repeat block.
WordWriter provides two methods for binding merge fields to a data sourc= e: SetDataSource and SetRepeatBlock. SetDataSource sets a data source for m= erge fields in the main document. SetRepeatBlock sets data sources for merg= e fields within repeat blocks.
The main document may include multiples s= ets of merge fields, where each set of fields binds to a different data sou= rce. A SetDataSource call is required for each set of main document merge f= ields. Only one row of data can be imported to each set of main document me= rge fields. When you include more than one set of merge fields in the main = document, use any of the following SetDataSource methods to set data source= s:SetDataSource(object[] data, string[] fieldNames, string name) SetDataSource(DataSet ds, string name) SetDataSource(DataTable dt, string name) SetDataSource(IDataReader dr, string name)=20
SetDataSource(data() As Object, fieldNames() As String, name As = String) SetDataSource(ds As DataSet, name As String) SetDataSource(dt As DataTable, name As String) SetDataSource(dt As IDataReader, name As String)=20
The SetDataSource method is described in fuller detail on this page in o= ur product documentation: SetDataSource.
A template can include multiple repeat blocks. Each repeat block binds t= o a different data source. A SetRepeatBlock call is required for each repea= t block in the template. A repeat block will be repeated for each row retur= ned from the data source.
The "Purchase Order Document" code sample generates a Word fil= e from a template that contains a set of merge fields in the main document,= and a set of merge fields within a single repeat block. The repeat block's= bookmark name is "DetailRow." The code assigns two data sources = to the template. setDataSource binds an array data source to the main docum= ent's merge fields, and setRepeatBlock binds a ResultSet data source to the= merge fields within the "Detail Row" repeat block.