Message-ID: <242934424.10419.1711724471698.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_10418_337463393.1711724471698" ------=_Part_10418_337463393.1711724471698 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html SharePointIntegration.SetMailMerge(WordTemplate, Microsoft.Share= Point.SPView, Microsoft.SharePoint.SPList)

SharePointIntegration.SetMailMerge(WordTemplate, Microsoft.SharePoi= nt.SPView, Microsoft.SharePoint.SPList)

Introduced in build 4.1.0.1379

=20

Description

=20

Sets the MailMerge's data source to a SharePoint View. A MailMerge by de= fault treats the page content as a repeat block, repeating the page content= for each row unless NEXT fields are used. If the WordTemplate.EnableNEXTFields property is= set to true, the NEXT field can also be used to indicate that the next row= of data should be inserted instead of the current row at the next occurenc= e of the merge fields.

=20
C#
=20
public void SetMailMerge(this WordTemplate template, Microsoft.SharePoint.S=
PView view, Microsoft.SharePoint.SPList list)
=20
=20
vb.net
=20
Public Sub SetMailMerge(ByVal template As WordTemplate, ByVal view As Micro=
soft.SharePoint.SPView, ByVal list As Microsoft.SharePoint.SPList)
=20
=20

Parameters

=20
template
Current Wor= dTemplate that is calling SetMailMerge=20
view
A SharePoint View t= o use as a data source.=20
list
A SharePoint List t= o which the view applies=20

Exceptions

=20
ArgumentNull= Exception
=20 Save will t= hrow this exception if=20 null (C#) or=20 Nothing (VB.NET) is passed to the method.=20
ArgumentExceptio= n
=20

Remarks

=20

You can call SetMailMerge once for each instance of WordTemplate. If you are using the Exce= l 2003 binary template file type (.xls/.xlt), you can call SetMailMerge or = SetRepeatBlock, but not both.

=20

Additionally, only the page content is repeated for each row, not the en= tire page itself. If you wish to have the page itself repeat for each row, = you will need to remember to place a page break at the bottom of the page.<= /p>=20

Merge Fields for using the SetMailMerge method must not specify a data s= ource =E2=80=93 the data source is implied, and using a data source name wi= ll cause WordTemplate to throw an error. Valid merge field formats for use = with SetDataSource include field names («fieldname») and field ordinals («#1»).

=20
=20 Icon=20
=20

This is an extension method for the WordTemplate object to be used for b= inding SharePoint data to applications from within SharePoint. To use this = method, you must add a reference to SoftArtisans.OfficeWriter.WordWriter.Sh= arePointIntegration.dll

=20
=20
=20

Examples

=20
C#
=20

          //--- Set the mail merge
          //--- The data source is the SharePoint View myView
          wt.SetMailMerge(myView, myList);
          wt.Process();
        
=20
=20
vb.net
=20
          '--- Set the mail merge
          '--- The data source is the SharePoint View myView
          wt.SetMailMerge(myView, myList)
          wt.Process()
        
=20
------=_Part_10418_337463393.1711724471698--