Трихедит в Rave Memo буфер - PullRequest
0 голосов
/ 16 июля 2011

Как поместить форматированное содержимое TRichEdit в буфер заметок Rave, TMemoBuf?

1 Ответ

0 голосов
/ 17 июля 2011

Вы должны использовать функцию Lines.SaveToStream из компонента TRichEdit, чтобы получить форматированный текст (rtf) и использовать TMemoBuf.RTFLoadFromStreamфункция для загрузки текста RTF в TMemoBuf.

var
  MemoryStream: TMemoryStream;
begin
  MemoryStream:= TMemoryStream.Create;
  try
    //get the rtf data from the RichEdit into from the Memory stream
    RichEdit1.Lines.SaveToStream(MemoryStream);
    MemoryStream.Position := 0;
    //load the rtf data into the TMemoBuf
    MemoBuf1.RTFLoadFromStream(MemoryStream,0);
  finally
    MemoryStream.Free;
  end;
end;
...