Hi,

Is it possible to append a trichedit component's stream to another trichedit? LoadFromStream doesn't seem to work though, perhaps theres another way to append its Tmemorystream before passing into the LoadFromStream method?

This is what i've been doing, but It doesn't work because RichEdit2 has its own RTF header when copied over, and RichEdit2 will not see its appended text.

procedure TForm2.Button1Click(Sender: TObject);
var
ms: TMemoryStream;
ms2: TMemoryStream;
begin

Memo1.Text := GetRTF(RichEdit1);
Memo1.Text := Memo1.Text + GetRTF(RichEdit2);

RichEdit2.Text := Memo1.Text;
end;

function TForm2.GetRTF(RE: TRichedit): string;
var
strStream: TStringStream;
begin
strStream := TStringStream.Create('') ;
try
RE.PlainText := False;
RE.Lines.SaveToStream(strStream) ;
Result := strStream.DataString;
finally
strStream.Free
end;
end;

That was my first thought too, but I realized that very problem would occur. Having thought it over some the answer is embarrassingly obvious: just cut and paste the text.

Hope this helps.

Duoas, how do i do that programmatically?

str := Clipboard.AsText;
Clipboard.AsText := '';
RichEdit1.SelectAll;
RichEdit1.CopyToClipboard;
RichEdit2.PasteFromClipboard;

Clipboard.AsText := str;