Append text to RTF file
-
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
-
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
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; }
-
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; }
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