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

loop by paragraph and paste one by one in another RichTextBox

1 Answer 97 Views
RichTextBox (obsolete as of Q3 2014 SP1)
This is a migrated thread and some comments may be shown as answers.
Alejandro Fabian
Top achievements
Rank 1
Alejandro Fabian asked on 26 Sep 2012, 06:45 PM
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

1 Answer, 1 is accepted

Sort by
0
Svett
Telerik team
answered on 01 Oct 2012, 01:09 PM
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 >>
Tags
RichTextBox (obsolete as of Q3 2014 SP1)
Asked by
Alejandro Fabian
Top achievements
Rank 1
Answers by
Svett
Telerik team
Share this question
or