See Also

RichTextBox Class  | RichTextBox Members  | InsertField  | Walkthrough: Rich Text and Field Merging

Language

Visual Basic

C#

Show All

fieldName
Name of the merge field to be replaced with the specified text.
replaceText
The value used to replace the specified field.
See Also Languages ActiveReports Send feedback to Data Dynamics

ReplaceField Method

Merges the contents of the RTF stream with the field values specified.

[Visual Basic]
Public Sub ReplaceField( _    ByVal fieldName As String, _    ByVal replaceText As String _ )
[C#]
public void ReplaceField(    string fieldName,    string replaceText );

Parameters

fieldName
Name of the merge field to be replaced with the specified text.
replaceText
The value used to replace the specified field.

Remarks

A merge field is created using the InsertField method.

You can use this method to create mail-merge RTF content in your report.  The control will replace all occurrences of the field with the specified value.

Example

[C#] 

private void ghCustomerID_Format(object sender, System.EventArgs eArgs) 
{     
    this.rtf.ReplaceField("CompanyName", m_companyName);     
    this.rtf.ReplaceField("ContactName", m_contactName);     
    this.rtf.ReplaceField("AddressLine", m_addressLine);     
    this.rtf.ReplaceField("City", m_city);     
    this.rtf.ReplaceField("Region", m_region);     
    this.rtf.ReplaceField("Country", m_country);     
    this.rtf.ReplaceField("PostalCode", m_postalCode);     
    this.rtf.ReplaceField("Date", System.DateTime.Today.Date.ToString()); 
}

[Visual Basic] 

Private Sub ghCustomerID_Format(ByVal sender As Object, ByVal e As System.EventArgs) Handles ghCustomerID.Format
    Me.rtf.ReplaceField("CompanyName", m_companyName)
    Me.rtf.ReplaceField("ContactName", m_contactName)
    Me.rtf.ReplaceField("AddressLine", m_addressLine)
    Me.rtf.ReplaceField("City", m_city)
    Me.rtf.ReplaceField("Region", m_region)
    Me.rtf.ReplaceField("Country", m_country)
    Me.rtf.ReplaceField("PostalCode", m_postalCode)
    Me.rtf.ReplaceField("Date", System.DateTime.Today.Date)
End Sub

See Also

RichTextBox Class  | RichTextBox Members  | InsertField  | Walkthrough: Rich Text and Field Merging

 

 


Copyright © 2004-2005 Data Dynamics, Ltd. All rights reserved.