Home TdxRichEditControl on delphi? how to add and get rich text to this programatically?
Reply: 1

TdxRichEditControl on delphi? how to add and get rich text to this programatically?

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

is anyone here worked with TdxRichEditControl from DevExpress on delphi? devExpress Don't provide Docs on how to add and get rich text to this control programatically. 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
2#
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) ;
var
  RTFStream: TEditStream;
  Stream : TMemoryStream;

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

begin
  Stream := TMemoryStream.Create;
  try
    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.') ;
  finally
    Stream.Free;
  end;
end;
You need to login account before you can post.

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

© 2016 Powered by cudou.com design MATCHINFO