![]() |
Brauch RTF Code für Text
Kann mir einer den RTF Code für ganz normal Text sagen? Schwarz, Schriftgröße 8!
Ich kenn mich damit nicht so aus. Ich weiß noch nicht einmal ob es sowas gibt, aber IMHO müsste es sowas geben! Ich muss nur ein string 's' in RTFCode umwandeln, damit ich ihn dann in ein jvxRichEdit schreiben kann. Danke im voraus :!: |
Re: Brauch RTF Code für Text
Warum kuckst du nicht selber nach, wie das aussieht?
|
Re: Brauch RTF Code für Text
Wie denn? Ich habe mich mit so was noch nie wirklich beschäftigt :!:
|
Re: Brauch RTF Code für Text
Schon mal eine RTF-Datei mit Notepad angekuckt? Da gibt es nichts mit zu beschäftigen.
|
Re: Brauch RTF Code für Text
|
Re: Brauch RTF Code für Text
Ja, aber wenn ich in Word nur 'hallo' eingebe und als RTF Speichere, erhalte ich nur folgendes:
Zitat:
|
Re: Brauch RTF Code für Text
Danke, jetzt habe ich den RTF text. Jetzt hab eich aber probleme ihn in das jvxrichedit reinzumachen! Wie mache ich das?
|
Re: Brauch RTF Code für Text
du kannst word verwenden(besser wordpad), musst dann aber beim speichern das rtf-Format auswählen und nicht *.doc.
|
Re: Brauch RTF Code für Text
Ja, die MS-Produkte gehen da sehr großzügig mit den RTF-Tags um.
Code:
Sollte das Wort "begin" fett darstelln und das Wort "Hallo" normal.
{\rtf1\ansi\deff0\deflang1033{\fonttbl{\f0\fmodern Courier New;}}
\viewkind4\uc1\pard\b\f0\fs20 begin \b0 Hallo \par } Das Attribut Fett wir durch das \b eingeleitet und durch \b0 beendet. |
Re: Brauch RTF Code für Text
Habe ich ja gemacht!
|
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 08:44 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