|
-
Mar 8th, 2010, 12:46 PM
#1
Thread Starter
Member
[RESOLVED] Saving RTF in XML file
Hello,
I am working on a note taking application. I have got a treeview and a richtextbox. On the treeview note captions are organized in a hierarchy. When a tree node is clicked related note details are displayed in the richtextbox. I use an xml file to save and load the treeview state (including nodes, expand collapse state, image index etc). I want to include all the note details in this xml file as well. But I don’t know how to save richtextformat into an xml file. If someone helps me I will be very happy. Thank you.
-
Mar 8th, 2010, 12:56 PM
#2
Re: Saving RTF in XML file
You should be able to save it just like any other text. So when you save it, save the .RTF and when you load it, set the .RTF to the value from the XML. You may need to wrap the data in CDATA tags within the XML, in case there are any special characters in the rtf string.
-
Mar 8th, 2010, 02:22 PM
#3
Thread Starter
Member
Re: Saving RTF in XML file
Negative0, thank you very much for your reply. After your post, I realized that I can save richtext just like any other text. First, I use savefile method of richtextbox and I save a temporary file as rtf. Then I open it by using streamreader and convert it to regular string. Then I put it to xml file. When I want to load the file, I get the text by using streamreader. I write it to a temporary file by using stream writer, as rtf. Finally I use the LoadFile method of the richtextbox to load file in rich text box. I guess that was what you were saying in your post. Currently my problem has been solved thanks to your reply.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|