loop by paragraph and paste one by one in another RichTextBox

2 posts, 0 answers
  1. Alejandro Fabian
    Alejandro Fabian avatar
    1 posts
    Member since:
    Jan 2008

    Posted 26 Sep 2012 Link to this post

    hello
    I need to make a loop by paragraph and paste one by one in another RichTextBox
    someone could tell me how you could do.

    thanks greetings
  2. Svett
    Admin
    Svett avatar
    728 posts

    Posted 01 Oct 2012 Link to this post

    Hello Alejandro,

    You can iterate through paragraphs in RadRichTextBox by using the following code snippet:
    foreach (Paragraph p in this.radRichTextBox1.Document.EnumerateChildrenOfType<Paragraph>())
    {
        Paragraph paragraphCopy = p.CreateDeepCopy() as Paragraph;
        richTextBox2.Document.Sections.Last.Blocks.Add(paragraphCopy);
    }

    I hope this helps.

    Kind regards,
    Svett
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top