This is a migrated thread and some comments may be shown as answers.

Mail merge Data populate on radRichtextBox

7 Answers 72 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Vitall
Top achievements
Rank 1
Vitall asked on 14 May 2013, 09:25 AM
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);
}

7 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 14 May 2013, 11:29 AM
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.
0
Vitall
Top achievements
Rank 1
answered on 14 May 2013, 11:36 AM
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.
0
Petya
Telerik team
answered on 16 May 2013, 04:43 PM
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.

0
Daniel
Top achievements
Rank 1
answered on 16 Jul 2018, 11:53 AM

Hi, as i seee you have large experience with merge fields, should you help me?

I am developing an application that list all merge fields and bookmarks in an user interface based on rich text documents (rtf). The user can change some merge fields and bookmaks properties. the bookmarks is done, but the merge fields i have problems to list and reference. the merge field will be selected in a list and highlighted in the editor, and the application provides the options to change his properties.

0
Tanya
Telerik team
answered on 19 Jul 2018, 08:34 AM
Hi Daniel,

Could you please elaborate more on what are the difficulties you are facing for the case? What are the properties that the users can change? Is it an option to differentiate the merge fields by the properties from the source collection they point to?

Regards,
Tanya
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
0
Daniel
Top achievements
Rank 1
answered on 19 Jul 2018, 01:55 PM

Hi Tanya, my problem is not in data populate, i can explain better: My application is a rtf template conversor.

we get template from others and replace with out data, using bookmarks. i meet a lot of difficulties in this process, some of this is the

field kind the others work that. but i meet a solution, replace the text by bookmarks seraching the variable string name in the rtf content.

thank you!

0
Tanya
Telerik team
answered on 24 Jul 2018, 09:49 AM
Hello Daniel,

Am I correct in thinking that you managed to achieve the desired goal? Nevertheless, I would like to mention that the merge fields are the built-in functionality that allows you to replace data in a template document with the records from a particular collection.

Regards,
Tanya
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which you to write beautiful native mobile apps using a single shared C# codebase.
Tags
RichTextBox
Asked by
Vitall
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Vitall
Top achievements
Rank 1
Petya
Telerik team
Daniel
Top achievements
Rank 1
Tanya
Telerik team
Share this question
or