![]() |
RTF to plain text (without formats)
Hallo,
ich habe in einem Datenbankfeld den Inhalt eines RichText Feldes mit all den Formatierungsanweisungen. Gibt es eine einfache Möglichkeit diese komplett zu entfernen und damit nur den unformatierten Text zu bekommen? |
Re: RTF to plain text (without formats)
In TRichEdit gibt es dafür die Eigenschaft .PlainText;
|
Re: RTF to plain text (without formats)
Hm, das habe ich schon versucht, bin aber schon daran gescheitert den Text überhaupt in die TRichEdit Komponente zu bekommen.
Ich verwende übrigens Delphi5 Enterprise ... die Turbo Delphi Professional Version habe ich nur privat. Ich habs so probiert:
Delphi-Quellcode:
var
lText, lText2: string; begin ... lText := GetText(); //Hier ist der RTF Formatierte Text drinnen ... with TRichEdit.Create(nil) do try Parent := Self; Lines.Text := lText; //<--- Das will er so nicht PlainText := true; lText2 := Lines.Text; finally Free; end; end; |
Re: RTF to plain text (without formats)
-was meinst du mit will er nicht?
TDBRichEdit ? |
Re: RTF to plain text (without formats)
Nein ich meinte schon TRichEdit.
Es kommt zur Laufzeit eine Meldung, dass man so keine lines hinzufügen kann. Kompilierbar ist es aber. |
Re: RTF to plain text (without formats)
Hast du mal die db-aware Variante getestet?
|
Re: RTF to plain text (without formats)
Diese Funktion mal probieren:
Delphi-Quellcode:
function RTF2PlainText(s: Integer): string;
var RichEdit: TRichEdit; begin RichEdit := TRichEdit.CreateParented(HWND(-3)); try with RichEdit do begin SelectAll; SelText := s; Result := Text; end; finally RichEdit.Free; end; end; |
Re: RTF to plain text (without formats)
@MKinzler:
Ich bin mir nicht ganz sicher, man zum Entfernen der Rich Text Formatierungen jetzt eine Datenbank dazumachen muss... bzw. sehe ich jetzt den Sinn dahinter nicht, was mir die Datenbankgebunden Version der RichText Komponente helfen soll. @Poelser: Deine Funktion hat leider nur den Nachteil, dass im Ergebnis immer noch die RTF Formatierung enthalten ist. |
Re: RTF to plain text (without formats)
Zitat:
Zitat:
|
Re: RTF to plain text (without formats)
Zitat:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:51 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-2025 by Thomas Breitkreuz