Message-ID: <1798408056.9193.1711679299811.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_9192_533559983.1711679299811" ------=_Part_9192_533559983.1711679299811 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Sets the specified repeat block's data source to an ADO.NET DataTable. <= /p>=20
public void SetRepeatBlock(System.Data.DataTable dt, System.String bookmar= k)=20
Public Sub SetRepeatBlock(ByVal dt As System.Data.DataTable, ByVal bookmark= As String)=20
The bookmark name of the template repeat block. The bookmark passed to <= code>SetRepeatBlock must exist in the template Word file. To see a l= ist of template bookmark names:
=20SetRepeatBlock
will throw this exception if=20
null
(C#) or=20
Nothing
(VB.NET) is passed to the method.=20
SetRepeatBlock
will throw this exception if the=20
bookmark
has been set to be=20
r=
emoved.=20
A repeat block is a fragment in the template document that will be repea= ted for each row in a data source. In the template document, repeat blocks = are defined by Word bookmarks that contain merge fields.
=20You can call SetRepeatBlock several times for a single instance of WordTemplate. The =
repeat block specified by the parameter bookmark
must exist in=
the template.
If you pass an empty DataTable to SetRepeatBlock
, WordWrite=
r will not include the specified repeat block in the generated Word file.=
p>=20
Not all Word features can be included in a repeat block:
$body=20Supported in Repeat Blocks | =20
Not Supported in Repeat Blocks | =20
---|---|
| =20
| =20
//--- A DataTable with the data to be repeated DataTable ds =3D GetDataTable(); WordTemplate oWW =3D new WordTemplate(); oWW.Open("c:\\template.doc"); //--- Set a data source for the repeat block //--- defined by the bookmark "Page" //--- "dt" is the DataTable containing the data to be //--- imported and repeated in the repeat block oWW.SetRepeatBlock(dt, "Page"); oWW.Process(); oWW.Save(Page.Response, "Output.doc", false);=20
'--- A DataTable with the data to be repeated Dim ds As DataTable =3D GetDataTable() Dim oWW As New WordTemplate() oWW.Open("c:\template.doc") '--- Set a data source for the repeat block '--- defined by the bookmark "Page" '--- "dt" is the DataTable containing the data to be '--- imported and repeated in the repeat block oWW.SetRepeatBlock(dt, "Page") oWW.Process() oWW.Save(Page.Response, "Output.doc", False)=20