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 / C++ / MFC
  4. How to save the content of an "Rich Edit Control" As IT IS?

How to save the content of an "Rich Edit Control" As IT IS?

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++tutorial
4 Posts 4 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.
  • J Offline
    J Offline
    Joseph Marzbani
    wrote on last edited by
    #1

    Sorry, I konw this is a quite rube question. But I'm new in MFC programming. Any way, I want to save the whole content of an Rich Edit Control with the right format with which characters and words are wrtten.

    Thank you masters!

    M J I 3 Replies Last reply
    0
    • J Joseph Marzbani

      Sorry, I konw this is a quite rube question. But I'm new in MFC programming. Any way, I want to save the whole content of an Rich Edit Control with the right format with which characters and words are wrtten.

      Thank you masters!

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      Maybe CRichEditCtrl::StreamOut[^]?

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      1 Reply Last reply
      0
      • J Joseph Marzbani

        Sorry, I konw this is a quite rube question. But I'm new in MFC programming. Any way, I want to save the whole content of an Rich Edit Control with the right format with which characters and words are wrtten.

        Thank you masters!

        J Offline
        J Offline
        JJeffrey
        wrote on last edited by
        #3

        I am currently using

            TCHAR  TextArray\[MAXARRAY\]={0};
        m\_RichEditCtrlVariable.GetWindowText(TextArray, MAXARRAY);
        CHARFORMAT CharForm;
        m\_RichEditCtrlVariable.GetSelectionCharFormat(CharForm);
        

        GetWindowText will get the words and newline characters and what not. GetSelectionCharFormat will get the font type, font size, bold, italics, colour, etc. Though, this has a problem if the font changes at any point in the rich edit box. It'll only return the first character set details it encounters. Don't know if that'll help youi in any way

        1 Reply Last reply
        0
        • J Joseph Marzbani

          Sorry, I konw this is a quite rube question. But I'm new in MFC programming. Any way, I want to save the whole content of an Rich Edit Control with the right format with which characters and words are wrtten.

          Thank you masters!

          I Offline
          I Offline
          Iain Clarke Warrior Programmer
          wrote on last edited by
          #4

          I would strongly encourage the Stream functionality (EM_STREAMIN/OUT) as it will give you a text stream with the formatting embedded in. You'll be amazed at how big it ends up. If you want a good reference for the rich edit control, with all sorts of formatting stuff, look at http://www.codeproject.com/KB/edit/rulerricheditctrl.aspx[^]. It's a great article by Johan Rosengren, only harmed by my flailing about in his code to make it UNICODE compatible. Iain.

          Codeproject MVP for C++, I can't believe it's for my lounge posts...

          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