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. Visual Basic
  4. Append text to RTF file

Append text to RTF file

Scheduled Pinned Locked Moved Visual Basic
helpquestion
3 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.
  • T Offline
    T Offline
    Taen_Karth
    wrote on last edited by
    #1

    I have created a very simple program that will basically keep and changelog file. I consists of three forms 1. Main menu form (New Change, Show Summary, Exit) 2. New Change form (textbox, 2 buttons, RT box) 3. Summary Form (RT box control) What I would like to happen: 1. When user clicks on New Change button in Main Menu I would like it to load the new change form. On the form there is a Textbox for name entry, a button that once clicked adds the name and timestamp to the RT box in Bold font, and a button for Save/Close. When I Save/Close I would like for the bold text in the RT Box to Append to the top of an existing .rtf file. 2. When user clicks Summary i would like the form to load the .rtf file in its entirety. (Read Only) Number two I don't have a problem with. Number one I cannot get to append. Here are the choices I ahve tried thus far: 1. Use the .SaveFile option. Works great but no Append option 2. Use a StreamWriter to write the information. This also works great but I cannot seem to get it to keep the RTF formatting. I have tried a lot of the Encoding types and it does not seem that a Streamwriter can write in RTF encoding. Am I wrong here? Please let me know in what direction I should head on this...=)

    Thanks, Taen Karth

    G 1 Reply Last reply
    0
    • T Taen_Karth

      I have created a very simple program that will basically keep and changelog file. I consists of three forms 1. Main menu form (New Change, Show Summary, Exit) 2. New Change form (textbox, 2 buttons, RT box) 3. Summary Form (RT box control) What I would like to happen: 1. When user clicks on New Change button in Main Menu I would like it to load the new change form. On the form there is a Textbox for name entry, a button that once clicked adds the name and timestamp to the RT box in Bold font, and a button for Save/Close. When I Save/Close I would like for the bold text in the RT Box to Append to the top of an existing .rtf file. 2. When user clicks Summary i would like the form to load the .rtf file in its entirety. (Read Only) Number two I don't have a problem with. Number one I cannot get to append. Here are the choices I ahve tried thus far: 1. Use the .SaveFile option. Works great but no Append option 2. Use a StreamWriter to write the information. This also works great but I cannot seem to get it to keep the RTF formatting. I have tried a lot of the Encoding types and it does not seem that a Streamwriter can write in RTF encoding. Am I wrong here? Please let me know in what direction I should head on this...=)

      Thanks, Taen Karth

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      A rich text textbox control and a rich text file are two quite different things. The rich text textbox control is just a textbox that supports formatting, and that can export the formatting as an rtf document. The RTF file format is a document format, it's not an encoding for formatted text. You can't add text to an rtf file by just appending (or prepending) text. You have to open the rtf document, add the text to the document body, and save the changed document.

      --- b { font-weight: normal; }

      T 1 Reply Last reply
      0
      • G Guffa

        A rich text textbox control and a rich text file are two quite different things. The rich text textbox control is just a textbox that supports formatting, and that can export the formatting as an rtf document. The RTF file format is a document format, it's not an encoding for formatted text. You can't add text to an rtf file by just appending (or prepending) text. You have to open the rtf document, add the text to the document body, and save the changed document.

        --- b { font-weight: normal; }

        T Offline
        T Offline
        Taen_Karth
        wrote on last edited by
        #3

        So how would I accomplish this task? or is there a better way other than RTF for saving and readin formatted text

        Thanks, Taen Karth

        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