Database into radRichTextBox

4 posts, 0 answers
  1. John
    John avatar
    3 posts
    Member since:
    Oct 2011

    Posted 28 Oct 2011 Link to this post

    OK, I'm quite new at these controls, and when I have my database code attempt to insert text/rtf into the Rich Textbox, I use txtBox.text=reader etc.  However, nothing happens. I know this control is different but I'm stumped. How do I load text, doc and rtf from my database into the radRichTextBox?
  2. Stefan
    Stefan avatar
    2891 posts

    Posted 01 Nov 2011 Link to this post

    Hi John,

    Please find the answer to your questions in the Support Thread which you have opened. 

    As you probably noticed, Support Treads are answered according to your support package (in your case 24 hrs, business days only), while forum threads are usually reviewed within 72 hrs (business days only) . So if you need an urgent response, please use the support channel. Alternatively, if you want to discuss or share something with the community, feel free to use our forums.

    I hope that you find this information useful.
    the Telerik team

    Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.

  3. DevCraft R3 2016 release webinar banner
  4. GM
    GM avatar
    6 posts
    Member since:
    Jul 2011

    Posted 08 Dec 2011 Link to this post

    I am also curious about this answer - is it possible to add the answer to the forum as I cannot see the support thread being mentioned above.
  5. Nikolay
    Nikolay avatar
    1802 posts

    Posted 11 Dec 2011 Link to this post

    Hello Gm,

    Please find the answer below:

    As this article states, here is how to import a Word document in RadRichTextBox document:

    public RadDocument ImportDocx()
        RadDocument document = null;
        IDocumentFormatProvider provider = new DocxFormatProvider();
        OpenFileDialog openDialog = new OpenFileDialog();
        openDialog.Filter = "Documents|*.docx";
        openDialog.Multiselect = false;
        DialogResult dialogResult = openDialog.ShowDialog();
        if (dialogResult == System.Windows.Forms.DialogResult.OK)
            using (FileStream stream = new FileStream(openDialog.FileName, FileMode.Open))
                document = provider.Import(stream);
        return document;

    Afterwards, simply set the returned document to the control's document:
    private void radButton1_Click(object sender, EventArgs e)
       radRichTextBox1.Document = ImportDocx();

    That is what it takes to load a word document in RadRichTextBox. Attached you can find a sample project with a sample word file, demonstrating the described approach.

    the Telerik team

    Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

Back to Top