We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,613 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Printing from textbox value

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?

4
Contributors
6
Replies
1 Day
Discussion Span
5 Months Ago
Last Updated
8
Views
ponkhiraj
Newbie Poster
14 posts since Nov 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 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...

john.knapp
Posting Whiz in Training
221 posts since Oct 2012
Reputation Points: 25
Solved Threads: 22
Skill Endorsements: 3

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.

tinstaafl
Nearly a Posting Virtuoso
1,294 posts since Jun 2010
Reputation Points: 341
Solved Threads: 225
Skill Endorsements: 14

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.

john.knapp
Posting Whiz in Training
221 posts since Oct 2012
Reputation Points: 25
Solved Threads: 22
Skill Endorsements: 3

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.

TnTinMN
Practically a Master Poster
640 posts since Jun 2012
Reputation Points: 418
Solved Threads: 148
Skill Endorsements: 13

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.

ponkhiraj
Newbie Poster
14 posts since Nov 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

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

tinstaafl
Nearly a Posting Virtuoso
1,294 posts since Jun 2010
Reputation Points: 341
Solved Threads: 225
Skill Endorsements: 14

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0802 seconds using 2.71MB