FlexReport for .NET | ComponentOne
Fields / Rtf Field
In This Topic
    Rtf Field
    In This Topic

    The Rich Text Formatted (RTF) field is used to display a formatted text. When you click this button, a menu appears where you can select other fields that are contained in the same report definition file to be displayed in RTF format. These are data-bound RTF fields.

    RTF fields are particularly used in creating Mail Merge reports.

    To create a mail merge using RTF field in FlexReportDesigner application:

    1. Create a new report FlexReportDesigner.
    2. Bind the report to 'Customers' and 'Orders' Table by giving the following Sql statement:
      SELECT
      Customers.CustomerID, Customers.CompanyName,
      Customers.ContactName, Customers.Address,
      Customers.City, Customers.Region, Customers.Country, Customers.PostalCode,
      Orders.OrderID, Orders.OrderDate, [Order Subtotals].Subtotal
      FROM Customers INNER JOIN ([Order Subtotals] INNER JOIN Orders
      ON [Order Subtotals].OrderID = Orders.OrderID)
      ON Customers.CustomerID = Orders.CustomerID
      WHERE CompanyName = "Ernst Handel"
      
    3. From the Insert tab add the RTF field RTF text field icon.
    4. From the Properties window, set the Background color to a light color.
    5. Set the Text property to following expression:  

      "Dear " + ContactName + "," + vbcrlf + vbcrlf + _
      "Your order for past year totals to " + Format(Subtotal, "Currency") + vbcrlf + vbcrlf + _
      "Because you have been such a terrific customer, " + _
      "we decided to credit your account with $0.10. The amount will be credited in next 10 days._
      Your Address for future correspondance is "+"Address" + vbcrlf + vbcrlf + _
      "Congratulations!"

    6. Arrange the fields as shown.

      RTF text field

    7. Preview the report.

      RTF field preview