![]() |
Re: Brauch RTF Code für Text
Zitat:
Bei mir funktioniert's so:
Delphi-Quellcode:
uses
RichEdit; // RichEdit Type type TMyRichEdit = TJvRichEdit; // Stream Callback function type TEditStreamCallBack = function(dwCookie: Longint; pbBuff: PByte; cb: Longint; var pcb: Longint): DWORD; stdcall; TEditStream = record dwCookie: Longint; dwError: Longint; pfnCallback: TEditStreamCallBack; end; // EditStreamInCallback callback function function EditStreamInCallback(dwCookie: Longint; pbBuff: PByte; cb: Longint; var pcb: Longint): DWORD; stdcall; // by P. Below var theStream: TStream; dataAvail: LongInt; begin theStream := TStream(dwCookie); with theStream do begin dataAvail := Size - Position; Result := 0; if dataAvail <= cb then begin pcb := read(pbBuff^, dataAvail); if pcb <> dataAvail then Result := UINT(E_FAIL); end else begin pcb := read(pbBuff^, cb); if pcb <> cb then Result := UINT(E_FAIL); end; end; end; procedure PutRTFSelection(RichEdit: TMyRichEdit; SourceStream: TStream); // by P. Below var EditStream: TEditStream; begin with EditStream do begin dwCookie := Longint(SourceStream); dwError := 0; pfnCallback := EditStreamInCallBack; end; RichEdit.Perform(EM_STREAMIN, SF_RTF or SFF_SELECTION, Longint(@EditStream)); end; Beispiel: Rtf Code in TJvRichEdit laden:
Delphi-Quellcode:
procedure TForm1.Button2Click(Sender: TObject);
var SS: TStringStream; begin SS := TStringStream.Create('{\rtf1\ansi\ansicpg1252\deff0\deflang2055{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}{\f1\fnil MS Sans Serif;}}\viewkind4\uc1\pard\ul\b\f0\fs24 Test\ulnone\b0\f1\fs16\par}'); try PutRTFSelection(JvRichEdit1, SS); finally SS.Free; end; end; |
Re: Brauch RTF Code für Text
[edit] Ich bin ein Trottel :wall: [/edit]
|
Re: Brauch RTF Code für Text
Ist seltsam, bei mir funktioniert's so.
Lade mal ein Demo-Projekt hoch, dann kann ich's testen. |
Re: Brauch RTF Code für Text
Ne jetzt klappt alles. Aber nachdem ich den Text hinzugefügt habe (mit putRTFselection) dann macht er danach immer einen Zeilenumbruch! Woran liegt das?
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 03:04 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