delphirtfdelphi-2009richedittrichedit

How to assign richly formatted text to Delphi TRichEdit or TcxRichEdit during design time (possibly, using Lines attribute)?


I just want to assign immutable, richly formatted text to RichEdit (or DevExpress cxRichEdit, which, obviously is inherited from VCL RichEdit) during design time. I know how to do a lot of formatting during run-time using Selection of text and setting attributes to this selection. But I have no need for this flexibility - I just have long text with some words in bold and there is no need to modify it in runtime, this is some information/documentation for the user.

How can I assign such text during design time? RichEdit does not have sophisticated editor (at least I can not find it) for the Lines attribute. I tried to create RTF document in Word and then copy-paste its value (text with RTF markup) into Lines attribute, but then RichEdit shows all the RTF markup. Besides, Word adds incredibly lot of RTF additional information, not just some RTF tags here and there.

How to add formatted text in design time?


Solution

  • IMO this is not possible to add formatted text at design time.

    You can load it at run time:

    RichEdit1.Lines.LoadFromFile(FileName);