Home How to programmatically add and get rich text using a TdxRichEditControl?
Reply: 1

How to programmatically add and get rich text using a TdxRichEditControl?

Soufiane Bra
Soufiane Bra Published in 2017-09-12 13:14:14Z

DevExpress doesn't provide docs about "How to programmatically add and get rich text using a TdxRichEditControl". Or Any suggestion to Embedded Full text Editor in my program? I am on Delphi Seattle.

My Situation:

I am creating a program on which the user need rich text editing (like Bold, Italic, Underlining, Font Size, Font family, Paragraph Aligning). So I've putted a DBRichEdit that load a model of text on which the user will make changes. So I need to take this model text to the TdxRichEditControl to apply the changes and back it again to the DBRichEdit to save it in the database.

Dave Nottage
Dave Nottage Reply to 2017-09-12 21:31:33Z

If you want to just insert portions of text into the control, this is some code I used to use for copying from one DevExpress RichEdit to another.. You might be able to adapt it to copy from another source (warning - it's a few years old):

procedure AppendToRichEdit(const Source, Dest: TcxRichEdit) ;
  RTFStream: TEditStream;
  Stream : TMemoryStream;

  function EditStreamReader(dwCookie: DWORD; pBuff: Pointer; cb: LongInt; pcb: PLongInt): DWORD; stdcall;
    Result := $0000;
      pcb^ := TStream(dwCookie).Read(pBuff^, cb);
      Result := $FFFF;

  Stream := TMemoryStream.Create;
    Source.Lines.SaveToStream(Stream) ;
    Stream.Position := 0;
    RTFStream.dwCookie := DWORD(Stream) ;
    RTFStream.dwError := $0000;
    RTFStream.pfnCallback := @EditStreamReader;
    Dest.InnerControl.Perform(EM_STREAMIN, SFF_SELECTION or SF_RTF or SFF_PLAINRTF, LPARAM(@RTFStream)) ;
    if RTFStream.dwError <> $0000 then
      raise Exception.Create('Error appending RTF data.') ;
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.409375 second(s) , Gzip On .

© 2016 Powered by cudou.com design MATCHINFO