RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TDBRichEdit.PlainText Property

Controls whether the rich edit control treats the text as plain text or rich text when streaming to or from a file.

Pascal
property PlainText: Boolean;
C++
__property Boolean PlainText;

To write the rich text in the control to a plain text file, set PlainText to true before streaming the text to a file. To ignore the rich text information encoded in a file, set PlainText to true before streaming the text to the control. To stream in the rich text attributes encoded in a file, or save the encoding of the rich text attributes to a file, set PlainText to false. 

If the rich text attributes of a file are encoded in some format other than rich text format (RTF), it is necessary to use a converter on the text, even when PlainText is true.

Note: Rich edit controls do not directly support streaming. Use the Lines property to stream to or from a file.
 

C++ Examples: 

 

/*
This example requires two TRichEdit controls placed on the
form.  When the form becomes visible, the first Rich Edit
control will display the rich text in its raw form, including
formatting characters. The second will show the rich text in
its intended format.
*/
void __fastcall TForm1::FormCreate(TObject *Sender)
{
// you may need to change this path to suit your environment
  char const *Path = "..\\OVERVIEW.RTF";
  RichEdit1->PlainText = true;
  RichEdit1->Lines->LoadFromFile(Path);
  RichEdit2->PlainText = false;
  RichEdit2->Lines->LoadFromFile(Path);
}

 

Delphi Examples: 

{
This example requires two TRichEdit controls placed on the 
form.  When the form becomes visible, the first Rich Edit 
control will display the rich text in its raw form, including
formatting characters. The second will show the rich text in 
its intended format.
}

procedure TForm1.FormCreate(Sender: TObject);
const
  // you may need to change this path to suit your environment
  Path = 'OverView.RTF';
begin
  RichEdit1.PlainText := True;
  RichEdit1.Lines.LoadFromFile(Path);
  RichEdit1.ScrollBars := ssVertical;
  RichEdit2.PlainText := False;
  RichEdit2.Lines.LoadFromFile(Path);
  RichEdit2.ScrollBars := ssVertical;
end;

 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!