...
Description |
---|
Excerpt |
---|
Sets the MailMerge's |
...
data |
...
source |
...
to |
...
a |
...
two-dimensional |
...
(rectangular) |
...
array |
...
of |
...
objects. |
...
A |
...
MailMerge |
...
by |
...
default |
...
treats |
...
the |
...
page |
...
content |
...
as |
...
a |
...
repeat |
...
block, |
...
repeating |
...
the |
...
page |
...
content |
...
for |
...
each |
...
row |
...
unless |
...
NEXT |
...
fields |
...
are |
...
used. |
...
If |
...
the |
...
...
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 |
...
occurence |
...
of |
...
the |
...
merge |
...
fields. |
...
This |
...
should |
...
largely |
...
imitate |
...
the |
...
behavior |
...
of |
...
a |
...
Microsoft |
...
Word |
...
...
merge. |
...
Signature | ||||
---|---|---|---|---|
| ||||
public void SetMailMerge(System.Object[][] jaggedArray, System.String[] columnNames)
{signature}
{signature: |
Signature | ||||||
---|---|---|---|---|---|---|
| }
| |||||
Public Sub SetMailMerge(ByVal jaggedArray As Object()(), ByVal columnNames As String())
{signature}
{parameters}
{param:jaggedArray}The jagged array \(array\-of\-arrays\) to use as the data source.
{param}
{param:columnNames}The one\-dimensional array of strings that represent the field names to be replaced by the data. These names must match the column names from your data source.
{param}
{exceptions}
{exception:ArgumentNullException}[Save|WordTemplate.Save] will throw this exception if {{null}} \(C\#\) or {{Nothing}} \(VB.NET\) is passed to the method.
{exception}
{exception:ArgumentException}
{exception}
{remarks}You can call [SetMailMerge|WordTemplate.SetMailMerge] once for each instance of [WordTemplate]. If you are using the Word 2003 binary template file type |
Parameters |
---|
Param | ||||
---|---|---|---|---|
| ||||
The jagged array (array-of-arrays) to use as the data source. |
Param | ||||
---|---|---|---|---|
| ||||
The one-dimensional array of strings that represent the field names to be replaced by the data. These names must match the column names from your data source. |
Exceptions |
---|
Exception | ||||
---|---|---|---|---|
| ||||
Save will throw this exception if |
Exception | ||||
---|---|---|---|---|
| ||||
Remarks | ||||||
---|---|---|---|---|---|---|
You can call SetMailMerge once for each instance of WordTemplate. If you are using the Word 2003 binary template file type (.doc/.dot), you can call SetMailMerge or SetRepeatBlock, but not both. Additionally, only the page content is repeated for each row, not the entire 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. Alternatively, you can create a hidden page break at the top of the page as follows: *
Merge Fields for using the SetMailMerge method must not specify a data source --– the data source is implied, and using a data source name will cause WordTemplate to throw an error. Valid merge field formats for use with SetMailMerge include field names (*«fieldname»*) and field ordinals (*«#1»*). {introducedin: 8.2} [SetMailMerge|WordTemplate.SetMailMerge] will now work with headers and footers. A section break is required instead of a page break if each header or footer will be different. {remarks} {example}{code:csharp|title=C#}(«fieldname») and field ordinals («#1»).
SetMailMerge will now work with headers and footers. A section break is required instead of a page break if each header or footer will be different. |
Example | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|