Autor Beitrag
Crowbar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 180

WinXP, SP2
D6 Enterprise
BeitragVerfasst: Mo 28.07.03 11:44 
Hallo,
ich habe folgendes Problem:
Ich lade in eine RichEdit-Komponente eine rtf-Datei. Jetzt ist noch alles in Ordnung. Füge ich jetzt zusätzlich z.B. am Ende eine weitere rtf-Datei ein, erscheint der zuletzt eingefügte Text nicht mehr formatiert und man sieht nur die "Formatierungsbefehle".

So schaut dann mein RichEdit aus:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
Hallo das ist ein Test!

{\rtf1\ansi\deff0\deftab720{\fonttbl{\f0\fswiss MS Sans Serif;}{\f1\froman\fcharset2 Symbol;}{\f2\fswiss Tahoma;}}
{\colortbl\red0\green0\blue0;\red128\green0\blue0;}
\deflang1031\pard\plain\f2\fs20\cf1\ul Ein zweiter Test:
\par \plain\f2\fs20\cf0 Test\plain\f2\fs20\cf0\b 
\par }


Eigentlich sollte es so aussehen:
ausblenden Quelltext
1:
2:
3:
4:
Hallo das ist ein Test!

Ein zweiter Test:
Test


Wer kann helfen?
Tschüss Crowbar
MSCH
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1448
Erhaltene Danke: 3

W7 64
XE2, SQL, DevExpress, DevArt, Oracle, SQLServer
BeitragVerfasst: Mo 28.07.03 14:33 
dat jeht so niche. Du kannst ja auch keine 2 Word-Dateien zusammen-mergen um eine zu erhalten.
Ich glaub da gibts ne funktion in der TF Komponente *grübel* "einfügen aus" oder so.

grez
msch
Guardian of R'lyeh
Hält's aus hier
Beiträge: 14

Windows9x, WindowsXP
D7 Prof
BeitragVerfasst: Mo 28.07.03 14:44 
folgendermaßen habe ich es aber hinbekommen:

ausblenden Quelltext
1:
2:
3:
4:
   
   Richedit1.Lines.LoadFromFile('d:\D1.rtf');
   Richedit2.Lines.LoadFromFile('d:\D2.rtf');
   RichEdit1.Text := Richedit1.Text + Richedit2.Text;


etwas blöde, aber es funktioniert...das zweite RichEdit hab ich dann einfach unsichtbar gemacht.

mmh...leider geht die Formatierung verloren....*grübel*
kasi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 37

Win XP
D5 Ent
BeitragVerfasst: Mo 28.07.03 18:24 
Da kannst du das Clipboard benutzen
z.B.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
procedure TForm1.InsertRTF(Filename: string; RichEdit: TRichEdit);
var
  Temp: TRichEdit;

begin
Temp := TRichEdit.Create(self);
try
  Temp.Visible := false;
  Temp.parent := self;
  Temp.Lines.LoadFromFile(Filename);
  Temp.SelectAll;
  Temp.CopyToClipboard;
  RichEdit.PasteFromClipboard;
finally
  Temp.Free;
end;
end;

Fügt eine RTF-Datei an der aktuellen Cursorposition von RichEdit ein

KASI
Crowbar Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 180

WinXP, SP2
D6 Enterprise
BeitragVerfasst: Di 29.07.03 07:57 
Hallo,
ja dies mit der "temp." RichEdit-Komponente, dem LoadFromFile und dann den Weg über das Clipboard funktioniert prima!

Habt alle vielen Dank für die Hilfe! :-)

Bye Crowbar