1,105,399 Community Members

Printing from textbox value

Member Avatar
ponkhiraj
Newbie Poster
14 posts since Nov 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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?

Member Avatar
john.knapp
Posting Whiz in Training
221 posts since Oct 2012
Reputation Points: 25 [?]
Q&As Helped to Solve: 22 [?]
Skill Endorsements: 4 [?]
 
0
 

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...

Member Avatar
tinstaafl
Postaholic
2,012 posts since Jun 2010
Reputation Points: 559 [?]
Q&As Helped to Solve: 403 [?]
Skill Endorsements: 36 [?]
 
0
 

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.

Member Avatar
john.knapp
Posting Whiz in Training
221 posts since Oct 2012
Reputation Points: 25 [?]
Q&As Helped to Solve: 22 [?]
Skill Endorsements: 4 [?]
 
0
 

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.

Member Avatar
TnTinMN
Practically a Master Poster
640 posts since Jun 2012
Reputation Points: 418 [?]
Q&As Helped to Solve: 152 [?]
Skill Endorsements: 16 [?]
 
0
 

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.

Member Avatar
ponkhiraj
Newbie Poster
14 posts since Nov 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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.

Member Avatar
tinstaafl
Postaholic
2,012 posts since Jun 2010
Reputation Points: 559 [?]
Q&As Helped to Solve: 403 [?]
Skill Endorsements: 36 [?]
 
1
 

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

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: