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 WordTemplate.SetRepeatBlock(System.Data.DataTable, String)</titl= e> <!--[if gte mso 9]> <xml> <o:OfficeDocumentSettings> <o:TargetScreenSize>1024x640</o:TargetScreenSize> <o:PixelsPerInch>72</o:PixelsPerInch> <o:AllowPNG/> </o:OfficeDocumentSettings> <w:WordDocument> <w:View>Print</w:View> <w:Zoom>90</w:Zoom> <w:DoNotOptimizeForBrowser/> </w:WordDocument> </xml> <![endif]--> <style> <!-- @page Section1 { size: 8.5in 11.0in; margin: 1.0in; mso-header-margin: .5in; mso-footer-margin: .5in; mso-paper-source: 0; } td { page-break-inside: avoid; } tr { page-break-after: avoid; } div.Section1 { page: Section1; } /* Confluence print stylesheet. Common to all themes for print medi= a */ /* Full of !important until we improve batching for print CSS */ #main { padding-bottom: 1em !important; /* The default padding of 6em is too mu= ch for printouts */ } body { font-family: Arial, Helvetica, FreeSans, sans-serif; font-size: 10pt; line-height: 1.2; } body, #full-height-container, #main, #page, #content, .has-personal-sidebar= #content { background: #fff !important; color: #000 !important; border: 0 !important; width: 100% !important; height: auto !important; min-height: auto !important; margin: 0 !important; padding: 0 !important; display: block !important; } a, a:link, a:visited, a:focus, a:hover, a:active { color: #000; } #content h1, #content h2, #content h3, #content h4, #content h5, #content h6 { font-family: Arial, Helvetica, FreeSans, sans-serif; page-break-after: avoid; } pre { font-family: Monaco, "Courier New", monospace; } #header, .aui-header-inner, #navigation, #sidebar, .sidebar, #personal-info-sidebar, .ia-fixed-sidebar, .page-actions, .navmenu, .ajs-menu-bar, .noprint, .inline-control-link, .inline-control-link a, a.show-labels-editor, .global-comment-actions, .comment-actions, .quick-comment-container, #addcomment { display: none !important; } .comment .date::before { content: none !important; /* remove middot for print view */ } h1.pagetitle img { height: auto; width: auto; } .print-only { display: block; } #footer { position: relative !important; /* CONF-17506 Place the footer at end of= the content */ margin: 0; padding: 0; background: none; clear: both; } #poweredby { border-top: none; background: none; } #poweredby li.print-only { display: list-item; font-style: italic; } #poweredby li.noprint { display:none; } /* no width controls in print */ .wiki-content .table-wrap, .wiki-content p, .panel .codeContent, .panel .codeContent pre, .image-wrap { overflow: visible !important; } /* TODO - should this work? */ #children-section, #comments-section .comment, #comments-section .comment .comment-body, #comments-section .comment .comment-content, #comments-section .comment p { page-break-inside: avoid; } #page-children a { text-decoration: none; } /** hide twixies the specificity here is a hack because print styles are getting loaded before the base styles. */ #comments-section.pageSection .section-header, #comments-section.pageSection .section-title, #children-section.pageSection .section-header, #children-section.pageSection .section-title, .children-show-hide { padding-left: 0; margin-left: 0; } .children-show-hide.icon { display: none; } /* personal sidebar */ .has-personal-sidebar #content { margin-right: 0px; } .has-personal-sidebar #content .pageSection { margin-right: 0px; } --> </style> </head> <body> <h1>WordTemplate.SetRepeatBlock(System.Data.DataTable, String)</h1> <div class=3D"Section1"> <h2 id=3D"WordTemplate.SetRepeatBlock(System.Data.DataTable,String)= -Description">Description</h2>=20 <p>Sets the specified repeat block's data source to an ADO.NET DataTable. <= /p>=20 <div class=3D"code panel pdl" style=3D"border-width: 1px;"> <div class=3D"codeHeader panelHeader pdl" style=3D"border-bottom-width: 1px= ;"> <b>C#</b> </div> <div class=3D"codeContent panelContent pdl">=20 <pre class=3D"theme: Default; brush: csharp; collapse: false; gutter: false= " style=3D"font-size:12px;"> public void SetRepeatBlock(System.Data.DataTable dt, System.String bookmar= k) </pre>=20 </div> </div>=20 <div class=3D"code panel pdl" style=3D"border-width: 1px;"> <div class=3D"codeHeader panelHeader pdl" style=3D"border-bottom-width: 1px= ;"> <b>vb.net</b> </div> <div class=3D"codeContent panelContent pdl">=20 <pre class=3D"theme: Default; brush: vbnet; collapse: false; gutter: false"= style=3D"font-size:12px;"> Public Sub SetRepeatBlock(ByVal dt As System.Data.DataTable, ByVal bookmark= As String) </pre>=20 </div> </div>=20 <h2 id=3D"WordTemplate.SetRepeatBlock(System.Data.DataTable,String)-Paramet= ers">Parameters</h2>=20 <h6 id=3D"WordTemplate.SetRepeatBlock(System.Data.DataTable,String)-dt">dt<= /h6> The DataTable to use as the data source.=20 <h6 id=3D"WordTemplate.SetRepeatBlock(System.Data.DataTable,String)-bookmar= k">bookmark</h6>=20 <p>The bookmark name of the template repeat block. The bookmark passed to <= code>SetRepeatBlock</code> must exist in the template Word file. To see a l= ist of template bookmark names: </p>=20 <ol>=20 <li>Open the template in Microsoft Word.</li>=20 <li>Open the <strong>Edit</strong> menu.</li>=20 <li>Select <strong>Go To...</strong></li>=20 <li>Select <strong>Bookmark</strong>.</li>=20 <li>Under <strong>Enter bookmark name</strong>, open the drop-down list of = bookmark names.</li>=20 </ol>=20 <h2 id=3D"WordTemplate.SetRepeatBlock(System.Data.DataTable,String)-Excepti= ons">Exceptions</h2>=20 <h6 id=3D"WordTemplate.SetRepeatBlock(System.Data.DataTable,String)-Argumen= tNullException">ArgumentNullException</h6>=20 <code>SetRepeatBlock</code> will throw this exception if=20 <code>null</code> (C#) or=20 <code>Nothing</code> (VB.NET) is passed to the method.=20 <h6 id=3D"WordTemplate.SetRepeatBlock(System.Data.DataTable,String)-Argumen= tException">ArgumentException</h6>=20 <span style=3D"color:black"><h4 id=3D"WordTemplate.SetRepeatBlock(System.Da= ta.DataTable,String)-Introducedinbuild8.4">Introduced in build 8.4</h4></sp= an>=20 <h6 id=3D"WordTemplate.SetRepeatBlock(System.Data.DataTable,String)-SAExcep= tion">SAException</h6>=20 <code>SetRepeatBlock</code> will throw this exception if the=20 <code>bookmark</code> has been set to be=20 <a href=3D"/display/WW11/WordTemplate.BookmarksToRemove" rel=3D"nofollow">r= emoved</a>.=20 <h2 id=3D"WordTemplate.SetRepeatBlock(System.Data.DataTable,String)-Remarks= ">Remarks</h2>=20 <p>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.</p>=20 <p>You can call <a href=3D"/display/WW11/WordTemplate.SetRepeatBlock" rel= =3D"nofollow">SetRepeatBlock</a> several times for a single instance of <a = href=3D"/display/WW11/WordTemplate" rel=3D"nofollow">WordTemplate</a>. The = repeat block specified by the parameter <code>bookmark</code> must exist in= the template.</p>=20 <p>If you pass an empty DataTable to <code>SetRepeatBlock</code>, WordWrite= r will not include the specified repeat block in the generated Word file.</= p>=20 <p>Not all Word features can be included in a repeat block:</p> $body=20 <div class=3D"table-wrap"> <div class=3D"table-wrap"> <table class=3D"confluenceTable"> <tbody>=20 <tr>=20 <th class=3D"confluenceTh"><p> Supported in Repeat Blocks </p></th>=20 <th class=3D"confluenceTh"><p> Not Supported in Repeat Blocks </p></th>=20 </tr>=20 <tr>=20 <td class=3D"confluenceTd"> <ul>=20 <li>Character Formatting (everywhere)</li>=20 <li>Paragraph Formatting (Alignment, Outlines, Indent, Spacing, Page Break = before, Keep Together)</li>=20 <li>Multiple Columns (2, 3, Column Breaks)</li>=20 <li>Borders and Shading</li>=20 <li>Tabs</li>=20 <li>Bullets</li>=20 <li>Numbering (numbering not reset, it is continued from one repeat block t= o another)</li>=20 <li>Page Breaks</li>=20 <li>Section Breaks</li>=20 <li>Auto Text Field</li>=20 <li>Hyperlink</li>=20 <li>Pictures</li>=20 <li>Table Row Repeat (entire row only)</li>=20 <li>Fields (with some restrictions)</li>=20 </ul> </td>=20 <td class=3D"confluenceTd"> <ul>=20 <li>Nested repeat blocks (Only one data source may be assigned to a single = repeat block.)</li>=20 <li>Overlapping bookmarks</li>=20 <li>Comments</li>=20 <li>Drawing Objects</li>=20 <li>Text Boxes</li>=20 <li>Footnote and endnote references</li>=20 <li>Table and picture indexes</li>=20 <li>Single cell in a table</li>=20 <li>Smart tags (smart tags will be removed from the document)</li>=20 <li>Repeat blocks in headers, footers, footnotes, comments, text boxes, etc= .</li>=20 </ul> </td>=20 </tr>=20 </tbody> </table> </div> </div> $body=20 <h2 id=3D"WordTemplate.SetRepeatBlock(System.Data.DataTable,String)-Example= s">Examples</h2>=20 <div class=3D"code panel pdl" style=3D"border-width: 1px;"> <div class=3D"codeHeader panelHeader pdl" style=3D"border-bottom-width: 1px= ;"> <b>C#</b> </div> <div class=3D"codeContent panelContent pdl">=20 <pre class=3D"theme: Default; brush: csharp; gutter: false" style=3D"font-s= ize:12px;"> //--- 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); </pre>=20 </div> </div>=20 <div class=3D"code panel pdl" style=3D"border-width: 1px;"> <div class=3D"codeHeader panelHeader pdl" style=3D"border-bottom-width: 1px= ;"> <b>vb.net</b> </div> <div class=3D"codeContent panelContent pdl">=20 <pre class=3D"theme: Default; brush: csharp; gutter: false" style=3D"font-s= ize:12px;"> '--- 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) </pre>=20 </div> </div> </div> </body> </html> ------=_Part_9192_533559983.1711679299811--