views:

396

answers:

3

I'm trying to create a notepad/wordpad clone. I want to save it in .rtf format so that it can be read by wordpad. How do I save a do this in C#?

+1  A: 

Correct me if I'm wrong, but if you're using the RichTextBox control, you can just use the RichTextBox.SaveFile method to accomplush this. Just a guess though that you mean doing it without using that control.

Tony k
I have to be honest with you, I didn't know this. Thanks!
Lucas McCoy
A: 

RTF SpecLink

create the xml spec based on their api and you can make your app compatible with wordpad, word etc.

CodeToGlory
+2  A: 

Assuming you are trying to do this yourself for learning purposes, you don't want to use a library to do it for you:

Basically you need to write a program which holds in memory either a string with RTF markup, or a DOM-like data tree. Using the RTF specification, you should write a flat (text) file marked up properly and with a .rtf extension. Just the same as if you were writing an HTML file.

Rex M
Dude, your getting pretty close to 10K. Nice job!
Lucas McCoy