Append document from one control to another

2 posts, 1 answers
  1. Abraham
    Abraham avatar
    2 posts
    Member since:
    Sep 2012

    Posted 12 Mar 2013 Link to this post

    I have two Telerik rich text boxes in my winforms application. I am trying to append the formatted text from one of the rich textboxes to all areas where a predefined section in the first rich textbox. 

    The below code works for finding the required predefined  sections - Once this is done, There was an option to insert a text but I couldnt find anything where I could insert the formatted text. 



    DocumentTextSearch search = new DocumentTextSearch(radRichTextBox1.Document);


    foreach (var textRange in search.FindAll("Section1"))






    // what to do here to insert the formattted text from radRichTextBox2


  2. Answer
    Stefan avatar
    2908 posts

    Posted 13 Mar 2013 Link to this post

    Hi Abraham,

    Thank you for writing.

    Here is how you can append (insert) the selected formatted text from the first RadRichTextBox control to the sections that you want in the second control:
    private void radButton1_Click(object sender, EventArgs e)
        DocumentFragment selectedFragment = radRichTextBox1.Document.Selection.CopySelectedDocumentElements();
        DocumentTextSearch search = new DocumentTextSearch(radRichTextBox2.Document);
        foreach (var textRange in search.FindAll("RichTextBox"))

    I hope that you find this information useful.

    the Telerik team
    WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
Back to Top