Directly Get or Set RTF content to a RTF ediotor.Prototype code is below:
http://www.codeproject.com/KB/edit/rulerricheditctrl.aspx
CString CRulerRichEditCtrl::GetRTF()
/* ============================================================
Function : CRulerRichEditCtrl::GetRTF
Description : Returns the contents of the control as RTF.
Access : Public
Return : CString - The RTF-contents of the control.
Parameters : none
Usage : Call this function to get a char buffer
with the contents of the embedded RTF-
control.
============================================================*/
{
CString* str = new CString;
EDITSTREAM es;
es.dwCookie = ( DWORD ) str;
es.pfnCallback = StreamOut;
m_rtf.StreamOut( SF_RTF, es );
CString output( *str );
delete str;
return output;
}
void CRulerRichEditCtrl::SetRTF( const CString& rtf )
/* ============================================================
Function : CRulerRichEditCtrl::SetRTF
Description : Set the contents of the embedded RTF-
control from rtf.
Access : Public
Return : void
Parameters : const CString& rtf - The rtf-contents to
set.
Usage : Call this function to set the RTF-contents
of the control.
============================================================*/
{
CString* str = new CString( rtf );
EDITSTREAM es;
es.dwCookie = ( DWORD ) str;
es.pfnCallback = StreamIn;
m_rtf.StreamIn( SF_RTF, es );
delete str;
}