Message-ID: <568021229.8133.1711633473171.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_8132_583318312.1711633473171" ------=_Part_8132_583318312.1711633473171 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 a multidimensional (rec= tangular) array of objects.
=20public void SetRepeatBlock(System.Object[,] table, System.String[] columnN= ames, System.String bookmark)=20
Public Sub SetRepeatBlock(ByVal table As Object(,), ByVal columnNames As St= ring(), 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
re=
moved.=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 repe=
at block specified by the parameter bookmark
must exist in the=
template.
If you pass an empty data source to SetRepeatBlock
WordWrit=
er 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 2-D rectangular array of values string[,] ValuesArr =3D {{"Boston", "MA"}, {"Miami", "FL"}, {"Merchantville", "NJ"}}; //--- Names array, elements correspond to merge field names string[] NamesArr =3D {"City", "State"}; WordTemplate wt =3D new WordTemplate(); wt.Open("template.doc"); //--- Set the repeat block defined by the bookmark "Block&qu= ot; //--- The data source is the 2-D rectangular ValuesArr array wt.SetRepeatBlock(ValuesArr, NamesArr, "Block"); wt.Process(); wt.Save("out.doc");=20
'--- A 2-D rectangular array of values Dim ValuesArr As String(,) =3D {{"Boston", "MA&qu= ot;}, _ {"Miami", "FL"}, _ {"Merchantville", "NJ"}} '--- Names array, elements correspond to merge field names Dim NamesArr As String() =3D {"City", "State"= } Dim wt As New WordTemplate() wt.Open("template.doc") '--- Set the repeat block defined by the bookmark "Block&quo= t; '--- The data source is the 2-D rectangular ValuesArr array wt.SetRepeatBlock(ValuesArr, NamesArr, "Block") wt.Process() wt.Save("out.doc")=20