Hi,
In my program, i have created 10 richtextbox dynamically. in all richtextbox i gather text form various websites.
All is going fine. now what i want is- i need to print all/selected richtextbox text to printer and also saves it to Word file as following formate:

  • Richtextbox1 (or something like header)

    richtextbox1.text.............
    ...............................
    ...............................
    ...............................
    =========================================

  • Richtextbox2 (or something like header)

    richtextbox2.text.............
    ...............................
    ...............................
    ...............................
    =========================================

  • Richtextbox3 (or something like header)

    richtextbox3.text.............
    ...............................
    ...............................
    ...............................
    =========================================

Can anyone help me on this issue? I hope i can do a crystal report based on it. But I have generated richtextbox dynamically. If possible by Crystal Report, how to get above format for richtextboxes one after one? How can i print on white page?

Send the text to Word first, then use Word to print it.

Did you search the forums first?
If you search the forum for "Word RichText" you'll find 6+ pages of discussions - I'm sure some of that code can be adapted to your needs, this one for example...

Edited 4 Years Ago by john.knapp

richtextbox.savefile will save the contents to a rich text file. I can't remember the exact parameters. Print should be able to be done by the print dialog, or once it's saved through Word.

richtextbox.savefile will save the contents to a rich text file. I can't remember the exact parameters.

RichTextBox.SaveFile(String)   
RichTextBox.SaveFile(Stream, RichTextBoxStreamType)
RichTextBox.SaveFile(String, RichTextBoxStreamType)

MSDN Documentation here.

Do you need to print from the application?

If so, printing with a WPF RichTextBox, it is pretty easy to get WYSIWYG results. It even handles embedded images. :)

Even if it is a WinForm application, you can always host a WPF RichTextBox in the Winform app.

I would recommend that you save as RTF. Word can read an RTF document.

Actually I'm looking for the solution where i can make above format automatically.
assume, i have more than 100 Richtextbox an i want to print on Word/PDF file by serially.

Sounds like you need a control array. It's not as intuitive in .net as VB6 but it can be done. Here's a link to an article from the MSDN Library on it. Here's a link to a project on control arrays

Edited 4 Years Ago by tinstaafl

This article has been dead for over six months. Start a new discussion instead.