Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Parsing RichText File

Parsing RichText File

Scheduled Pinned Locked Moved C#
csharpjsonhelpquestion
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kyledunn
    wrote on last edited by
    #1

    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

    L 1 Reply Last reply
    0
    • K kyledunn

      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

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #2

      just load the rtf file in a richtextbox, and print it, very easy :)

      K 1 Reply Last reply
      0
      • L leppie

        just load the rtf file in a richtextbox, and print it, very easy :)

        K Offline
        K Offline
        kyledunn
        wrote on last edited by
        #3

        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

        L 1 Reply Last reply
        0
        • K kyledunn

          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

          L Offline
          L Offline
          leppie
          wrote on last edited by
          #4

          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?

          K 1 Reply Last reply
          0
          • L leppie

            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?

            K Offline
            K Offline
            kyledunn
            wrote on last edited by
            #5

            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

            L 1 Reply Last reply
            0
            • K kyledunn

              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

              L Offline
              L Offline
              leppie
              wrote on last edited by
              #6

              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 :(

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups