Autor Beitrag
Aya
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Sa 08.03.03 01:34 
Hi,

wenn ich z.B. das mache:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
var
  s: String;
begin
  s:=RichEdit1.Text;
  RichEdit2.Text:=s;
end;

geht dabei die Formatierung des Textes verloren. Weiß jemand wie ich den Text inclusive Formatierung in einen String bekomme???

Au'revoir,
Aya

PS: Das ist nur ein Beispiel!! Es lässt sich nich einfach lösen indem ich schreibe RichEdit1.Text:=RichEdit2.Text ;)

_________________
Aya
I aim for my endless dreams and I know they will come true!
Luckie
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 08.03.03 06:22 
Du könntest es als RTF-Datei speichern und dann in eine Stringliste oder so laden, dann müßtest du die Formatierungen mit dabei haben. Was besseres fällt mir auf die Schnelle auch nicht ein.
Aya Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Sa 08.03.03 06:23 
mhh... ja, das ginge schon... aber erst als RTF Speichern... na ja, erstmal andere lösung suchen :)

_________________
Aya
I aim for my endless dreams and I know they will come true!
Aya Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Sa 08.03.03 06:30 
Hab es jetzt erstmal so gelöst:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
var
  S: String;
  SS: TStringStream;
begin
  SS:=TStringStream.Create(s);
  RichEdit.Lines.SaveToStream(SS);
  S:=SS.DataString;
  SS.Free;
  ShowMessage(s);
end;

Wenn jemand was besseres weiß, bitte sagen :)

Au'revoir,
Aya

_________________
Aya
I aim for my endless dreams and I know they will come true!
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Sa 08.03.03 11:46 
Hatte vor 3 Tagen dasselbe Problem, habs mit einem Memory-Stream gelöst:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
var tempstream:TStream
     text:String;
begin
tempstream:=TMemoryStream.Create;
RichEdit1.Lines.SaveToStream(tempstream);
tempstream.Position:=0;
Size:=tempstream.Size;
SetString(text,nil,Size);
tempstream.Read(PChar(text)^,Size);
end;
Aya Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1964
Erhaltene Danke: 15

MacOSX 10.6.7
Xcode / C++
BeitragVerfasst: Sa 08.03.03 16:59 
Da gefällt mir meine Lösung aber besser ;)

_________________
Aya
I aim for my endless dreams and I know they will come true!