Help Center

CRichEditCtx.GetRtfmethod

Retrieves formatted text from a rich edit control.

Windowsmethoddocumented

Syntax

FUNCTION GetRtf (BYVAL dwOptionsAndFlags AS DWORD = SF_RTF) AS STRING

Parameters

NameDescription
dwOptionsAndFlagsSpecifies the data format and replacement options.
wszFileNameThe name of the RTF file to load.

Return value

Returns the retrieved text or a null string.

If the operation succeeds, the return value is TRUE. If the operation fails, the return value is FALSE.

Description

Retrieves RTF formatted text from a Rich Edit control.

The SF_RTFNOOBJS option is useful if an application stores COM objects itself, as RTF representation of COM objects is not very compact. The control word, \objattph, followed by a space denotes the object position.

In addition, you can specify the following flags.

Remarks

First you have to create an instance of the CRichEditOleCallback class and pass a pointer to it to the rich edit control using the SetOleCallback method. Then load the .rtf file using the LoadRtfFromFile method.

Examples

DIM pRichEditOleCallback AS CRichEditOleCallback = CRichEditOleCallback pRichEdit.SetOleCallback(@pRichEditOleCallback)

pRichEdit.LoadRtfFromFile(<path and name of the RTF file>) e.g. pRichEdit->LoadRtfFromFile(AfxGetExePath & "\Test.rtf")

Reference

  • Defined in AfxNova/CRichEditCtx.inc:3326
  • Documented in Windows/WIndows Controls/RichEdit/CRichEditCtx Class.md
  • Topic: CRichEditCtx Class