Autor Beitrag
thbi
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 70

Mac OS X 10.4, WIN XP Prof.
D 4 Prof, D 7 Pers, xcode
BeitragVerfasst: So 09.10.05 14:32 
Hallo


Ich versuche ein RichEdit auszudrucken aber die Zeilenumbrüche werden nicht mitgedruckt!! Anstatt des Umbruchs werden Kästchen ausgedruckt und der Ausdruck ist ein einer Zeile und hört beim Seitenrand auf!!

Den Zeilen umbrich habe ich So Realisiert:

ausblenden Delphi-Quelltext
1:
 RichEdit1.Lines.Add (#10 + #13);					


Eine leere Zeile einfügen bringt auch nichts!! Im RichEdit wird es richtig angezeigt.

Vielleicht kennt einer einen anderen Lösungsvorschlag!!


THX

Mfg thbi

_________________
Wenn du etwas wirklich gern hast , dann lass es frei, kommt es zu dir zurück gehört es dir, kommt es nicht zurück, dann hat es dir nie gehört...
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: So 09.10.05 18:01 
Hallo,

wie sieht Deine Druck-Routine aus?

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
thbi Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 70

Mac OS X 10.4, WIN XP Prof.
D 4 Prof, D 7 Pers, xcode
BeitragVerfasst: So 09.10.05 18:05 
Der ist auch schon wo Rauskopiert!! Weil mein Latein am ende war aber mit dem Funzt es ja aber nicht die Absätzte!

Also hier wird alles in des RichEdit reingeladen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
procedure TForm2.Button3Click(Sender: TObject);
 var b: Integer;

begin

 RichEdit1.SelAttributes.Size:=18;
 RichEdit1.SelAttributes.Style:=[fsbold];
 RichEdit1.Lines.Add('Miniplan ' + 'von ' + Form2.Edit2.Text + ' bis ' + Form2.Edit3.Text);
 RichEdit1.SelStart;
 RichEdit1.Lines.Add('  ');
 RichEdit1.SelAttributes.Size:=12;
 //RichEdit1.SelAttributes.Style:=[fsbold, fsitalic];
 //RichEdit1.Lines.Add ('von ' + Form2.Edit2.Text + ' bis ' + Form2.Edit3.Text);


 RichEdit1.SelAttributes.Style:=[];
 for b:=0 to Form1.ListView1.Items.Count-1 do
  begin
   RichEdit1.Lines.Add(#15 + Form1.ListView1.Items.Item[b].Caption + '  ' + Form1.ListView1.Items.Item[b].SubItems.Strings[0] + '  ' + Form1.ListView1.Items.Item[b].SubItems.Strings[1] +'  ' + Form1.ListView1.Items.Item[b].SubItems.Strings[2] +' / ' + Form1.ListView1.Items.Item[b].SubItems.Strings[3] + #10 + #13);
   RichEdit1.Lines.Add (#10 + #13);
   RichEdit1.SelAttributes.Size:=12;
  end;
 if CheckBox1.Checked=True then RichEdit1.Lines.Add(Edit1.Text);

end;


Hier der Druckauftrag:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
sl:= RichEdit1.Text;


  if Form1.PrintDialog1.Execute then begin
    Printer.BeginDoc; //Druckjob beginnen

    //Blattgröße in 1/10 mm ermitteln:
    breite:=GetDeviceCaps(Printer.Canvas.Handle, HORZSIZE)*10;
    hoehe:=GetDeviceCaps(Printer.Canvas.Handle, VERTSIZE)*10;

    randlinks:=150//1,5 cm
    randoben:=150//1,5 cm

    x:=randlinks;
    y:=randoben*-1;

   // for zeile:=0 to sl.Count-1 do begin

      if -y>(hoehe-2*randoben) then begin
        y:=randoben*-1;
        Printer.NewPage;
      end;
      SetMapMode(Printer.Canvas.Handle, MM_LOMETRIC); //Umstellen auf 1/10 mm

      //Schrift-Einstellungen:
      Printer.Canvas.Font.Name:='Courier New';
      Printer.Canvas.Brush.Color:=clWhite;
      Printer.Canvas.Font.Height:=50//5 mm

      if y=-randoben then begin
        Printer.Canvas.Font.Style:=[fsbold];
        Printer.Canvas.TextOut(x, y, 'Seite '+
        IntToStr(Printer.PageNumber));
        Printer.Canvas.Font.Style:=[];
        y:=y-Printer.Canvas.TextHeight(sl[zeile]);
      end;

      Printer.Canvas.TextOut(x, y, sl);

      y:=y-Printer.Canvas.TextHeight(sl[zeile]);

    end;
    Printer.EndDoc;
  end;


Hoffe du kannst was damit anfangen!

_________________
Wenn du etwas wirklich gern hast , dann lass es frei, kommt es zu dir zurück gehört es dir, kommt es nicht zurück, dann hat es dir nie gehört...
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: So 09.10.05 21:06 
Hallo,

nutzt Du die Druckroutine so wie Du sie hier gepostet hast(for auskommentiert)?
Wenn ja, wie initialiesierst Du dann 'zeile' ?
Von welchem Typ ist die Variable ' sl' ?

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
thbi Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 70

Mac OS X 10.4, WIN XP Prof.
D 4 Prof, D 7 Pers, xcode
BeitragVerfasst: So 09.10.05 21:35 
1. sl ist Typ String.

2. So des bis jetzt am besten Funtioniert!! Wenn eine bessere Syntax kennst dann post die mir.

3. Zeile wird weiter obern gemacht!!

4. "for auskommentiert" Wo ist des??



Mfg thbi

_________________
Wenn du etwas wirklich gern hast , dann lass es frei, kommt es zu dir zurück gehört es dir, kommt es nicht zurück, dann hat es dir nie gehört...
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: So 09.10.05 22:38 
Hallo,
user profile iconthbi hat folgendes geschrieben:
4. "for auskommentiert" Wo ist des??

damit meinte ich die Zeile Nr. 17 in Deinem Code.

Dein fehlender Zeilenumbruch hat nichts mit Deinem RichEdit zu tun.
Er liegt in dem von Dir kopierten, veränderten Code für den Ausdruck.

Wenn Du den kompletten Inhalt über eine String-Variable per TextOut auf den Drucker schickst,
werden die Zeilenumbrüche nicht ausgegeben.
Für eine zeilenweise Ausgabe musst Du, -wie im Tutorial der dstd-, mit TStrings arbeiten.

Ein String ist etwas anderes als TStrings!
TStrings ist eine abstrakte Basisklasse für Objekte, die eine Liste mit Strings darstellen.

Hab Deinen Code mal überarbeitet und die Überarbeitungen mit //**** kenntlich gemacht.
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
var sl : TStrings;                                        //*****neu/geändert
    breite,hoehe,x,y,randlinks,randoben,zeile : integer;
begin
  sl := RichEdit1.Lines;                                       //*****geändert
  if Form1.PrintDialog1.Execute then
    begin
    Printer.BeginDoc; //Druckjob beginnen
    //Blattgröße in 1/10 mm ermitteln:
    breite:=GetDeviceCaps(Printer.Canvas.Handle, HORZSIZE)*10;
    hoehe:=GetDeviceCaps(Printer.Canvas.Handle, VERTSIZE)*10;
    randlinks:=150//1,5 cm
    randoben:=150//1,5 cm
    x:=randlinks;
    y:=randoben*-1;
    SetMapMode(Printer.Canvas.Handle, MM_LOMETRIC); //Umstellen auf 1/10 mm
    for zeile:=0 to sl.Count-1 do                //*****aktiviert
      begin
      if -y>(hoehe-2*randoben) then
        begin
        y:=randoben*-1;
        Printer.NewPage;
        end;
      Printer.Canvas.Font.Name:='Courier New';
      Printer.Canvas.Brush.Color:=clWhite;
      Printer.Canvas.Font.Height:=50//5 mm
      if y=-randoben then
        begin
        Printer.Canvas.Font.Style:=[fsbold];
        Printer.Canvas.TextOut(x, y, 'Seite '+
        IntToStr(Printer.PageNumber));
        Printer.Canvas.Font.Style:=[];
        y:=y-Printer.Canvas.TextHeight(sl[zeile]);
        end;
      Printer.Canvas.TextOut(x, y, sl[zeile]);  //*****geändert
      y:=y-Printer.Canvas.TextHeight(sl[zeile]);
      end;
    Printer.EndDoc;
    end;

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
thbi Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 70

Mac OS X 10.4, WIN XP Prof.
D 4 Prof, D 7 Pers, xcode
BeitragVerfasst: So 09.10.05 22:54 
Hey Danke!!!

Woher weiß man sowas wie TSring??? Hab auch Bücher und Internetseiten gelesen und hab nicht gefunden!!!


THX

Mfg thbi

_________________
Wenn du etwas wirklich gern hast , dann lass es frei, kommt es zu dir zurück gehört es dir, kommt es nicht zurück, dann hat es dir nie gehört...
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: So 09.10.05 23:44 
Hallo,
user profile iconthbi hat folgendes geschrieben:
...Woher weiß man sowas wie TSring??? ...

dann schreib mal bei Delphi 'TSrings' in den Editor,
setz den Cursor in den Begriff und drück die Taste F1(Hilfe) :wink:

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
thbi Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 70

Mac OS X 10.4, WIN XP Prof.
D 4 Prof, D 7 Pers, xcode
BeitragVerfasst: Mo 10.10.05 08:12 
Moin

JO des ist mir schon bekannt aber woher weiß man das es auch TString gibt!! Mein Buch "Grundlagen und Profiwissen" hat des auch noch nicht ausgespuckt auf den ersten 400 Seiten!! Gibt es irgendwo eine Liste mit alles Typen???


Mfg thbi

_________________
Wenn du etwas wirklich gern hast , dann lass es frei, kommt es zu dir zurück gehört es dir, kommt es nicht zurück, dann hat es dir nie gehört...
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Mo 10.10.05 12:15 
Hallo,
user profile iconthbi hat folgendes geschrieben:
...Gibt es irgendwo eine Liste mit alles Typen???

mir ist keine bekannt.

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
thbi Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 70

Mac OS X 10.4, WIN XP Prof.
D 4 Prof, D 7 Pers, xcode
BeitragVerfasst: Mo 10.10.05 17:03 
HI!!

Es funzt jetzt alles super aber die Leerzeile wird immer noch als Kästchen angezeigt!!

Des ist jetzt nur noch mein Problem!! :)

Mfg thbi

_________________
Wenn du etwas wirklich gern hast , dann lass es frei, kommt es zu dir zurück gehört es dir, kommt es nicht zurück, dann hat es dir nie gehört...
Flocke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 54

Win 2000, Win XP, Win 2003, Linux
Delphi 2006 Prof.
BeitragVerfasst: Mo 10.10.05 17:27 
Siehe hier...
thbi Threadstarter
ontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic star
Beiträge: 70

Mac OS X 10.4, WIN XP Prof.
D 4 Prof, D 7 Pers, xcode
BeitragVerfasst: Mo 10.10.05 18:07 
Des bring mir nicht viel!! Ich weiß was dort steht!!! Die hilfe hat mir tzozdem noch nicht weitergeholfen!


Mfg thbi

_________________
Wenn du etwas wirklich gern hast , dann lass es frei, kommt es zu dir zurück gehört es dir, kommt es nicht zurück, dann hat es dir nie gehört...
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Mo 10.10.05 23:51 
Hallo,

hast Du die Hinweise von user profile iconFlocke und den Anderen in der Delphi-Praxis beachtet und die Änderungen in Deinem Code zum Schreiben der Zeilen im RichEdit eingebaut?
Dann dürfte es eigentlich keine Probleme mehr geben.
Poste doch mal Deinen geänderten Code.

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )