Einzelnen Beitrag anzeigen

xaromz

Registriert seit: 18. Mär 2005
1.682 Beiträge
 
Delphi 2006 Enterprise
 
#2

Re: RTF-Code auslesen.

  Alt 6. Feb 2007, 21:51
Hallo,

Du musst die Daten direkt aus dem Control extrahieren. Versuch mal folgenden Code:
Delphi-Quellcode:
uses
  RichEdit;

...

function StringSave(dwCookie: Longint; pbBuff: PByte;
  cb: Longint; var pcb: Longint): Longint; stdcall;
var
  S: PString;
begin
  Result := NoError;

  S := PAnsiString(dwCookie);
  try
    S^ := S^ + PChar(pbBuff);
    pcb := cb;
  except
    Result := $0002; // WriteError
  end;
end;

function SaveRichEditToString(RichEdit: TRichEdit): AnsiString;
var
  EditStream: TEditStream;
  TextType: LongInt;
  S: AnsiString;
begin
  try
    with EditStream do
    begin
      dwCookie := Integer(@S);
      pfnCallBack := @StringSave;
      dwError := 0;
    end;
    if RichEdit.PlainText then
      TextType := SF_TEXT
    else
      TextType := SF_RTF;
    SendMessage(RichEdit.Handle, EM_STREAMOUT, TextType, Longint(@EditStream));
  finally
    Result := S;
  end;
end;
Gruß
xaromz
I am a leaf on the wind - watch how I soar
  Mit Zitat antworten Zitat