Parsing RichText File
-
I'm looking for information about parsing a RichText file for printing with C#. Can anyone help with some information or a lead to finding more about this process? Thanks, Kyle
-
Hi Leppie, I have the rtf file loaded into a richtextbox and I can print it as a standard text document without formatting or graphics but cannot yet print it with formatting and graphics. Can you tell me how to do this complete with formatting and graphics? Kyle
-
Hi Leppie, I have the rtf file loaded into a richtextbox and I can print it as a standard text document without formatting or graphics but cannot yet print it with formatting and graphics. Can you tell me how to do this complete with formatting and graphics? Kyle
-
i assume u used this method to load the file? richTextBox1.LoadFile(@"C:\MyDocs\Testdoc.txt", RichTextBoxStreamType.RichText); do u see it in the application as it should be printed?
Yes, I use the LoadFile method to load the file except I use the rtf extension for the filename, richTextBox1.LoadFile(@"C:\MyDocs\Testdoc.rtf"); and it does render properly in the richTextBox1. I can change the formatting, cut and paste images, save and reload the file and it always renders properly to the screen complete with images and formatting. I would like to print what I see on the screen. Actually I want to add the richTextBox contents to the end of a report I am already successfully printing. I can send the richtext formatting code to a stream and thought I might have to parse it to convert it the the proper information to feed the drawstring methods for printing. But I will appreciate any other options as well that will allow me to print the rtf document. Thanks for your help. Kyle
-
Yes, I use the LoadFile method to load the file except I use the rtf extension for the filename, richTextBox1.LoadFile(@"C:\MyDocs\Testdoc.rtf"); and it does render properly in the richTextBox1. I can change the formatting, cut and paste images, save and reload the file and it always renders properly to the screen complete with images and formatting. I would like to print what I see on the screen. Actually I want to add the richTextBox contents to the end of a report I am already successfully printing. I can send the richtext formatting code to a stream and thought I might have to parse it to convert it the the proper information to feed the drawstring methods for printing. But I will appreciate any other options as well that will allow me to print the rtf document. Thanks for your help. Kyle
hi thx for all the info, i havent , well cant try this at the moment, i have no printer :( there is very good printing examples in the code of the book GDI Plus (chapter 9) . u can download it at www.wrox.com . hope u that helps :) perhaps u are just missing a line or 2 :) PS: i see NOW that u need to paint the contents of the richtextbox to the derived graphics object from the PrintPage event. from msdn: Handle the PrintPage event where you specify the output to print, by using the Graphics included in the PrintPageEventArgs. the problem is to "paint" the content correctly to the graphics object. sorry, at the moment i cant help u anymore :(