...
Description |
---|
Excerpt |
---|
Sets the data source for the specified main document merge field to an object. The main document is the part of the document that is not within a repeat block. |
Signature | ||||
---|---|---|---|---|
| ||||
public void SetDataSource(System.Object value, System.String dataSourceName)
{signature}
{signature: |
Signature | ||||||
---|---|---|---|---|---|---|
| }
| |||||
Public Sub SetDataSource(ByVal value As Object, ByVal dataSourceName As String)
{signature}
{parameters}
{param:value}An object to use as a data source. WordWriter will insert this value in the specified merge field.
{param}
{param:name}The name of the the merge field at which to insert the value.
{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}The data marker requires a \#1 on the template. For example, to use the sample code below, you must have a merge field on the template with the data marker "FirstName.\#1".
{remarks}
{example}{code:csharp|title=C#} |
Parameters |
---|
Param | ||||
---|---|---|---|---|
| ||||
An object to use as a data source. WordWriter will insert this value in the specified merge field. |
Param | ||||
---|---|---|---|---|
| ||||
The name of the the merge field at which to insert the value. |
Exceptions |
---|
Exception | ||||
---|---|---|---|---|
| ||||
Save will throw this exception if |
Exception | ||||
---|---|---|---|---|
| ||||
Remarks |
---|
The data marker requires a #1 on the template. For example, to use the sample code below, you must have a merge field on the template with the data marker "FirstName.#1". |
Example | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|