Many word-processing applications can use Rich Text Format (RTF) files. However, some RTF formatting features supported by Word and other powerful products--such as the page break--aren't supported by the TRichText component. Even so, the TRichEdit's supported RTF formatting commands offer a rich collection of advanced formatting tools. You apply formatting via hidden commands in the text files. For example, an RTF file without any visible text might contain the following default headers and footers:
{\rtf1\ansi\deff0\deftab720{\fonttbl{\f0\fswiss
MS Sans Serif;}{\f1\froman\fcharset2
Symbol;}{\f2\fswiss\fcharset1 MS Sans
Serif;}{\f3\fswiss\fcharset1 MS Sans Serif;}}
{\colortbl\red0\green0\blue0;}
\deflang1033\pard\li500\ri-60\
fi-20\plain\f3\fs16\cf0
\par }
To
see these hidden RTF format commands, execute the following code:
//No visible commands appear.
ShowMessage(RichEdit1->Text);
TStringList *L= new TStringList();
RichEdit1->Lines->SaveToFile
("C:\Temp.Txt");
L->LoadFromFile("C:\Temp.Txt");
//This command shows RTF commands.
ShowMessage(L->Text);
delete L;