![]() |
Inhalt von TRichEdit ohne Verlust von DefAttributes kopieren
Wenn man 1 TRichEdit und 1 TDBRichEdit auf einer Form hat und möchte den Text vom TRichEdit in dem TDBRichEdit kopieren, wie macht man das ohne die DefAttributes zu verlieren.
Delphi-Quellcode:
geht nicht. Alle DefAttributes gehen verloren.
TDBRichEdit1.Text := RichEdit2.Text;
|
Re: Inhalt von TRichEdit ohne Verlust von DefAttributes kopi
Hai Heike,
meinst Du so etwas: ?
Delphi-Quellcode:
Procedure CopyRichEdit (aSource, aDestination : TRichEdit);
var RichStream : TMemoryStream; begin RichStream := TMemoryStream.Create; try aSource.Lines.SaveToStream(RichStream); RichStream.Position := 0; aDestination.Lines.LoadFromStream(RichStream); finally RichStream.Free; end; end; |
Re: Inhalt von TRichEdit ohne Verlust von DefAttributes kopi
Sorry, Ich habe es falsch dargestellt. Den Text von einem TRichEdit in einem TDBRichEdit kopieren, ohne dass farbiger Text usw. verloren geht.
|
Re: Inhalt von TRichEdit ohne Verlust von DefAttributes kopi
Geht das nicht mit dem Code oben wenn Du aDestitination nicht als TRichEdit sondern TDBRichEdit deklarierst?
|
Re: Inhalt von TRichEdit ohne Verlust von DefAttributes kopi
Schon versucht: ??
Delphi-Quellcode:
TDBRichEdit1.lines.Assign(RichEdit2.Lines);
|
Re: Inhalt von TRichEdit ohne Verlust von DefAttributes kopi
Zitat:
|
Re: Inhalt von TRichEdit ohne Verlust von DefAttributes kopi
Zitat:
|
Re: Inhalt von TRichEdit ohne Verlust von DefAttributes kopi
Dann hier noch eine weitere Variante:
Delphi-Quellcode:
Anwendung:
Procedure CopyRichEditLines(aSource, aDestination : TStrings);
var RichStream : TMemoryStream; begin RichStream := TMemoryStream.Create; try aSource.SaveToStream(RichStream); RichStream.Position := 0; aDestination.LoadFromStream(RichStream); finally RichStream.Free; end; end;
Delphi-Quellcode:
Query1.Edit; // wir müssen im Edit-Mode sein
CopyRichEditLines(RichEdit1.Lines, DBRichEdit1.Lines); |
Re: Inhalt von TRichEdit ohne Verlust von DefAttributes kopi
Zitat:
|
Re: Inhalt von TRichEdit ohne Verlust von DefAttributes kopi
Zitat:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:33 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz