Use the RichText Control
File: SAMPLES\SOLUTION\OLE\RTF.SCX
This sample illustrates using a RichText control to display and edit RTF text stored in the memo field of a table.
You can set the ControlSource of a RichText control directly to a character field, but not a memo field. Instead, create a form property to mediate between the RichText control and the memo field.
To store RTF text in a memo field
-
Set the ControlSource property of the RichText control to the form property.
THISFORM.oleRTF.ControlSource = THISFORM.cText
-
Store the memo field contents to the form property.
THISFORM.cText = rtf.source
-
Before moving the record pointer, store the TextRTF property of the RichText control to the memo field.
REPLACE rtf.Source WITH THISFORM.oleRTF.TextRTF
-
The text stored in the memo file is standard RTF format, for example:
-
{\rtf1\ansi\deff0\deftab720{\fonttbl{\f0\fswiss MS Sans Serif;}{\f1\froman\fcharset2 Symbol;}{\f2\fswiss Arial;}{\f3\fswiss Arial;}} {\colortbl\red0\green0\blue0;\red255\green0\blue0;} \deflang1033\pard\qc\plain\f3\fs32\i The RichTextBox Control \par \pard\plain\f3\fs20