Mail merge Data populate on radRichtextBox

4 posts, 0 answers
  1. Vitall
    Vitall avatar
    7 posts
    Member since:
    Apr 2013

    Posted 14 May 2013 Link to this post

    I need quick support to populate mail merge data on radrichtextbox. In the first step, i simply populate list of data in Mail merge like "FirstName", "LastName", then i want to get data associated with these tags e.g Firstname=Peter ....Please also take a look of below lines of code

    on Load
    this.radRichTextBox.Document.MailMergeDataSource.ItemsSource = new List<Employee>()
                {
                    new Employee()
                    {
                        FirstName = "Guest1",
                        LastName = "Guest2",  
                    },
                    new Employee()
                    {
                        FirstName = "Ali",
                        LastName = "Doc", 
                    }
                };

    private void btnPrint_Click(object sender, RoutedEventArgs e)
           {
               //this.radRichTextBox.InsertField(new MergeField() { PropertyPath = "FirstName" });
               MergeField field = new MergeField() { PropertyPath = "FirstName" };
               field.DisplayMode = FieldDisplayMode.Result;
               this.radRichTextBox.Document.ChangeFieldDisplayMode(field.FieldStart, FieldDisplayMode.Result);
    }
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 14 May 2013 Link to this post

    Hi Vitall,

    Please have a look at this documentation on Mail Merge which neatly explains setting up the data source and performing the mail merge.

    Thanks,
    Shinu.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Vitall
    Vitall avatar
    7 posts
    Member since:
    Apr 2013

    Posted 14 May 2013 Link to this post

    Hello Shinu,

    Good to see your quick reply. I tried this out but facing some reference issues. Please can you send me latest complete project so that i can run and figure out the problem.
  5. Petya
    Admin
    Petya avatar
    975 posts

    Posted 16 May 2013 Link to this post

    Hello Vitall,

    Additionally to what Shinu referenced, there is a demo on the topic. You can also find it here for Silverlight, but the code-base is the same.

    I am also attaching a sample project which demonstrates how to set MailMergeDataSource. You an insert a merge field using the drop down button in the Mailings tab or the button on the bottom which will insert a field  in result mode with the following code:
    MergeField field = new MergeField() { PropertyPath = "SenderFirstName",DisplayMode=FieldDisplayMode.Result };
    this.editor.InsertField(field);

    I hope this helps! Let us know if you have other questions.
     
    Regards,
    Petya
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top