Hallo,
man kann auch den RichEdit-Inhalt incl. der Formatierungen in einem String zwischenspeichern (unter Verwendung von TStringStream).
Speichern:
Delphi-Quellcode:
function GetRTFFromRichEdit(aRichEdit: TRichEdit): String;
var StrS : TStringStream;
begin
StrS := TStringStream.Create('');
try
aRichEdit.Lines.SaveToStream(StrS);
Result := StrS.DataString;
finally
StrS.Free;
end;
end;
Laden:
Delphi-Quellcode:
procedure SetRTFToRichEdit(sRTF: String;aRichEdit: TRichEdit);
var StrS : TStringStream;
begin
StrS := TStringStream.Create('');
try
StrS.WriteString(sRTF);
StrS.Position := 0;
aRichEdit.Lines.LoadFromStream(StrS);
finally
StrS.Free;
end;
end;