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. C#
  4. RichTextBox - Saving embedded controls

RichTextBox - Saving embedded controls

Scheduled Pinned Locked Moved C#
questiondatabasecomhardwarehelp
5 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.
  • A Offline
    A Offline
    Anthony Queen
    wrote on last edited by
    #1

    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.


    A 1 Reply Last reply
    0
    • A Anthony Queen

      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.


      A Offline
      A Offline
      Anthony Queen
      wrote on last edited by
      #2

      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.


      M 1 Reply Last reply
      0
      • A Anthony Queen

        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.


        M Offline
        M Offline
        mav northwind
        wrote on last edited by
        #3

        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 with RichTextBox.LoadFile() showed the object...

        Regards, mav -- Black holes are the places where God divided by 0...

        A 2 Replies Last reply
        0
        • M mav northwind

          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 with RichTextBox.LoadFile() showed the object...

          Regards, mav -- Black holes are the places where God divided by 0...

          A Offline
          A Offline
          Anthony Queen
          wrote on last edited by
          #4

          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.


          1 Reply Last reply
          0
          • M mav northwind

            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 with RichTextBox.LoadFile() showed the object...

            Regards, mav -- Black holes are the places where God divided by 0...

            A Offline
            A Offline
            Anthony Queen
            wrote on last edited by
            #5

            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.


            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