Hi,
what would be the easiest way to send text from AdvRichEditor to TQRRichText?
So far the only solution I found is to save save it to file using TAdvRichEditorRTFIO and then load it into TQRRichText. But that is not very practical and for sure should be some easier way.
Kind regards,
Bostjan
You can use:
AdvRichEditor.ContentAsRTF: string;
I'm not familiar with TQRRichText , but if this can be loaded from an RTF string, this is something you could directly use.
Hi, Bruno!
it's the same with TRichEdit also. I tried with your suggestion, but on my suprise it doesn't work:
procedure TForm1.Button1Click(Sender: TObject);
var MemoryStream: TMemoryStream;
SourceString:string;
begin
SourceString := AdvRichEditor1.ContentAsRTF;
MemoryStream := TMemoryStream.Create;
try
MemoryStream := TMemoryStream.Create;
MemoryStream.Clear;
MemoryStream.Write(PChar(SourceString)^, Length(SourceString));
MemoryStream.Position := 0;
RichEdit1.PlainText:=False;
RichEdit1.Lines.LoadFromStream(MemoryStream);
finally
MemoryStream.Free;
end;
end;
What I'm I doing wrong?
Kind regards,
Bostjan
I have retested this with this shorter code and it works without problems here:
var
ss: tstringstream;
begin
ss := tstringstream.Create;
ss.WriteString(advricheditor1.ContentAsRTF);
ss.Position := 0;
richedit1.lines.LoadFromStream(ss);
ss.Free;
end;
I confirm. I tried with your code and works great. Thank you.
Kind regards,
Bostjan