How to save the content of an "Rich Edit Control" As IT IS?
-
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!
-
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!
Maybe CRichEditCtrl::StreamOut[^]?
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
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 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 -
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 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...