RichTextBox - Saving embedded controls
-
I have written app, borrowing some code from this article ( http://www.codeproject.com/cs/miscctrl/MyExtRichTextBox.asp?df=100&forumid=229962&select=1556581&msg=1556581[^] ). I have controls being inserted at various locations throughout a document and everything looks great. I'm able to query the interface and iterate through each control in the document. Great. Now, however, I have to be able to save the document to be reloaded at a later time in the same application. When I do this normally, I lose the control information. So, how can I save the document so that when I reload it, my controls are still showing up in the richtextbox? Any help is greatly appreciated. Thanks, Tony
It's only when you look at an ant through a magnifying glass on a sunny day that you realise how often they burst into flames.
-
I have written app, borrowing some code from this article ( http://www.codeproject.com/cs/miscctrl/MyExtRichTextBox.asp?df=100&forumid=229962&select=1556581&msg=1556581[^] ). I have controls being inserted at various locations throughout a document and everything looks great. I'm able to query the interface and iterate through each control in the document. Great. Now, however, I have to be able to save the document to be reloaded at a later time in the same application. When I do this normally, I lose the control information. So, how can I save the document so that when I reload it, my controls are still showing up in the richtextbox? Any help is greatly appreciated. Thanks, Tony
It's only when you look at an ant through a magnifying glass on a sunny day that you realise how often they burst into flames.
When I look at the rtf, each place a control should be I have this: \objattph\'20 So, something is being saved. However, there are properties on each control that are unique for each control inserted. I need to persist this data.
It's only when you look at an ant through a magnifying glass on a sunny day that you realise how often they burst into flames.
-
When I look at the rtf, each place a control should be I have this: \objattph\'20 So, something is being saved. However, there are properties on each control that are unique for each control inserted. I need to persist this data.
It's only when you look at an ant through a magnifying glass on a sunny day that you realise how often they burst into flames.
Hi! What are you using to save/load the contents of the RTB? I just tried pasting an OLE object into the RTB, then saving it via
RichTextBox.SaveFile()
. Re-loading it afterwards withRichTextBox.LoadFile()
showed the object...Regards, mav -- Black holes are the places where God divided by 0...
-
Hi! What are you using to save/load the contents of the RTB? I just tried pasting an OLE object into the RTB, then saving it via
RichTextBox.SaveFile()
. Re-loading it afterwards withRichTextBox.LoadFile()
showed the object...Regards, mav -- Black holes are the places where God divided by 0...
Well, I'm not using an OLE object (which is the most likely reason why this doesn't work), I'm using a control I created in VS 2003. I'm fairly certain that if I implement the correct interfaces in the control that it will save correctly. But, I wouldn't swear to it. I've tried the save file, I've even tried streaming it straight to disk. The objects are there because I can (using IRichEditOle.GetObjectCount) get a correct count of objects, and actually get the objects back, cast them to the appropriate control and access their properties. This is all before saving though. Once saved, it seems that only a placeholder is saved, and not the object or it's data. Any ideas on what ole interfaces need to be implemented? Any Examples would be appreciated as well. I can't seem to find a lot of information about this. Thanks, Tony
It's only when you look at an ant through a magnifying glass on a sunny day that you realise how often they burst into flames.
-
Hi! What are you using to save/load the contents of the RTB? I just tried pasting an OLE object into the RTB, then saving it via
RichTextBox.SaveFile()
. Re-loading it afterwards withRichTextBox.LoadFile()
showed the object...Regards, mav -- Black holes are the places where God divided by 0...
Any help is appreciated.
It's only when you look at an ant through a magnifying glass on a sunny day that you realise how often they burst into flames.