Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi RTF to plain text (without formats) (https://www.delphipraxis.net/112611-rtf-plain-text-without-formats.html)

GuenterS 24. Apr 2008 13:06

Re: RTF to plain text (without formats)
 
Das habe ich probiert (mit true and false), aber das hat auch nichts gebracht.

Poelser 24. Apr 2008 13:20

Re: RTF to plain text (without formats)
 
Das habe ich mal schnell in leeres Projekt eingebaut:

Delphi-Quellcode:
function RTF2PlainText(s: String): 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;

procedure TForm1.Button1Click(Sender: TObject);
var
  rtf: string;
begin
  rtf := '{\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fnil Arial;}{\f1\fnil\fcharset0 Arial;}}\viewkind4\uc1\pard\f0\fs18 Ein Testtext\par \f0\par }';
  ShowMessage(RTF2PlainText(rtf));
end;
Es funktioniert anstandslos. Ich habe das Gefühl, dass du entweder kein "richtiges" RTF hast, oder deine RichEd32.dll in deinem Windows macht da Mist. :?

marabu 24. Apr 2008 13:23

Re: RTF to plain text (without formats)
 
Hallo Günter,

schau mal hier: Plaintext aus RTF auslesen

Freundliche Grüße

xaromz 25. Apr 2008 09:05

Re: RTF to plain text (without formats)
 
Hallo,

irgendwo in den Tiefen meines MWKEdit habe ich einen RTF-Parser versteckt. Den kannst Du Dir ja mal anschauen.

Gruß
xaromz


Alle Zeitangaben in WEZ +1. Es ist jetzt 02:29 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz