Autor Beitrag
thorstenf01
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 60

Win XP
D5 enterprise
BeitragVerfasst: So 17.08.03 14:47 
Hy,
kann mir jemand helfen, diese Datensätze bzw. den auszudruckenden
Text der unten stehenden "Ausdruck Prozedur" mit SaveDialog zu speichern. Meine Versuche sind bisher
leider fehlgeschlagen...
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:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
...
procedure TForm2.Button5Click(Sender: TObject);
begin
 if PrintDialog1.Execute then begin
  //Druckereinstellung
  Printer.BeginDoc;
  outDC := printer.canvas.Handle;
  SetMapMode(OutDC,mm_lometric);
  GetWindowExtEx(OutDC,w);
  GetViewportExtEx(OutDC,v);
  SetMapMode(OutDC,MM_Anisotropic);
  SetWindowExtEx(OutDC,w.cx,w.cy,nil);
  SetViewportExtEx(OutDC,v.cx,-v.cy,nil);
  with printer.canvas do begin

    Pen.Color := clBlack;
    font.Name:='Arial';

  Datensatz[1] :=IntToStr(Projekt);
  Datensatz[2] :=IntToStr(WKA);
  Datensatz[3] :=IntToStr(IP);
  Datensatz[4] := Aktz;
  Datensatz[5] := Datum;
  If HWKA = 0 then Datensatz[6] := '------' else
  Datensatz[6] := FloatToStr(HWKA);
  If HIP = 0 then Datensatz[7] := '------' else
  Datensatz[7] := FloatToStr(HIP);
  If RWKA = 0 then Datensatz[8] := '------' else
  Datensatz[8] := FloatToStr(RWKA);
  If RIP = 0 then Datensatz[9] := '------' else
  Datensatz[9] := FloatToStr(RIP);
  Datensatz[10] := FloatToStrF(rik,ffNumber, 8,1);
  Datensatz[11] := FloatToStrF(AziBeo,ffNumber, 8,1);
  Datensatz[12] := FloatToStr(NaHo);
  Datensatz[13] := FloatToStr(R);
  Datensatz[14] := FloatToStrF(GamRo,ffNumber, 8,1);
  If GeoBr = 0 then Datensatz[15] := '------' else
  Datensatz[15] := FloatToStrF(GeoBr,ffNumber, 8,2);
  If GeoLae = 0 then Datensatz[16] := '------' else
  Datensatz[16] := FloatToStrF(GeoLae,ffNumber, 8,2);
  Datensatz[17] := FloatToStrF(zk,ffNumber, 8,2);
  Datensatz[18] := FloatToStrF(zi,ffNumber, 8,2);
  Datensatz[19] := FloatToStrF(z0,ffNumber, 8,2);


    font.Height:=70;
    TextOut(250,200,'Zeitliche Registrierung des Schattenwurfs');
    TextOut(250,280,'von Windkraftanlagen');
    MoveTo(250,390);  LineTo(1820,390);
    font.Height:=45;
    TextOut(250,490,'Aktenvermerk:');    Tex := Datensatz[4];
    TextOut(560,490,Tex);
    TextOut(1110,490,'Datum:');          Tex := Datensatz[5];
    TextOut(1260,490,Tex);
    TextOut(250,540,'Projekt Nr. :');    Tex := Datensatz[1];
    TextOut(490,540,Tex);
    font.Height:=60;
    TextOut(250,640,'Eingabedaten für die Windkraftanlage (WKA) und den Immissionsort (IP)');
    TextOut(250,730,'WKA');
    TextOut(1110,730,'IP');
    font.Height:=45;
    TextOut(250,800,'Nr.:');   Tex := Datensatz[2];
    TextOut(340,800,Tex);
    TextOut(1110,800,'Nr.:');  Tex := Datensatz[3];
    TextOut(1200,800,Tex);
    TextOut(250,850,'Hochwert:'); Tex := Datensatz[6]+' m';
    TextOut(460,850,Tex);
    TextOut(1110,850,'Hochwert:');   Tex := Datensatz[7]+' m';
    TextOut(1320,850,Tex);
    TextOut(250,900,'Rechtswert:');  Tex := Datensatz[8];
    TextOut(500,900,Tex);
    TextOut(1110,900,'Rechtswert:');   Tex:= Datensatz[9];
    TextOut(1350,900,Tex);
    TextOut(250,950,'Rotorradius:');   Tex := Datensatz[13]+' m';
    TextOut(500,950,Tex);
    TextOut(250,1000,'Nabenhöhe:');     Tex := Datensatz[12]+' m';
    TextOut(500,1000,Tex);
    TextOut(250,1050,'Niveau über Meereshöhe:'); Tex := Datensatz[17]+' m';
    TextOut(750,1050,Tex);
    TextOut(1110,950,'Niveau über Meereshöhe:'); Tex := Datensatz[18]+' m';
    TextOut(1610,950,Tex);
    font.Height:=60;
    TextOut(250,1200,'Berechnungsdaten');
    font.Height:=45;
    TextOut(250,1270,'Geographische Breite:'); Tex := Datensatz[15]+'° N';
    TextOut(700,1270,Tex);
    TextOut(250,1320,'Geographische Länge:'); Tex := Datensatz[16]+'° O';
    TextOut(700,1320,Tex);
    TextOut(250,1370,'Entfernung zur WKA:'); Tex := Datensatz[10]+' m';
    TextOut(650,1370,Tex);
    TextOut(250,1420,'Azimut zur WKA:'); Tex := Datensatz[11]+' °';
    TextOut(600,1420,Tex);
    TextOut(250,1470,'Höhenwinkel der Rotornabe:'); Tex := Datensatz[14]+' °';
    TextOut(800,1470,Tex);
    TextOut(250,1520,'Höhendifferenz Nabenhöhe und IP:'); Tex := Datensatz[19]+' m';
    TextOut(900,1520,Tex);
    MoveTo(250,2500);  LineTo(1820,2500);
    end;
    Printer.EndDoc;
 end;
end;


Danke im voraus
Gruß
Thorsten
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: So 17.08.03 15:22 
deklariere eine Textvariable, weise ihr einen Namen via SaveDialog() zu und ersetze TextOut() mit Writeln(Textvariable,'mein Text').

So ohne weiteres kannst du keine Ausgabe vom Drucker(DC) in eine Textdatei(F) abspeichern. Du kannst aber eine Bitmap erstellen, und statt Printer.canvas BMP.Canvas nehmen.

grez
msch
thorstenf01 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 60

Win XP
D5 enterprise
BeitragVerfasst: So 17.08.03 18:56 
Hy,
könntest du ein kleines Beispiel geben... :?
Gruß
Thorsten
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 18.08.03 19:56 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
procedure Sichern;
var F:Textfile;
begin
  if SaveDialog.Execute then begin
    AssignFile(F,SaveDialog.Filename);
    Rewrite(F); // wenn vorhanden wird hier gnadenlos überschrieben
    writeln (F,'Zeitliche Registrierung des Schattenwurfs');
    writeln(F,'von Windkraftanlagen');
    // und so weiter
    fileClose(F);
  end;
end;

viel erfolg
msch
thorstenf01 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 60

Win XP
D5 enterprise
BeitragVerfasst: Mo 18.08.03 22:24 
Hy,
ich habs getestet und es klappt...
Danke,
Gruß
Thorsten