Autor Beitrag
broesis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19



BeitragVerfasst: Mo 15.12.03 18:18 
Hallo,

ich würde gerne, wenn es eine Möglichkeit gibt, ein Word Dokument per Delphi ausdrucken. Wie mache ich das?

Tschau
Broesis

_________________
"Wer andern eine Grube graebt ist Bauarbeiter"
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Di 16.12.03 09:16 
Hallo

eine Wordapplication-ServerKompo auf die Form drauf und dann z.B. so:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
procedure TForm1.Button1Click(Sender: TObject);
Var bo_t,i_range,i_item,i_copy:olevariant;
begin
  bo_t   := true;
  i_range:= wdPrintAllDocument;
  i_item := wdPrintDocumentContent;
  i_copy := 1;
  WordApplication1.activeDocument.PrintOut(bo_t,Emptyparam,i_range,
                                           Emptyparam,Emptyparam,Emptyparam,
                                           i_item,i_copy,emptyparam,
                                           Emptyparam,Emptyparam,Emptyparam,
                                           Emptyparam,Emptyparam);
end;


du kommst immer gut, wenn du dir ein Makro in Word aufzeichnest und es dir anschaust und umsetzt

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
broesis Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19



BeitragVerfasst: Di 16.12.03 16:19 
Hi!

Ich habe das Beispiel gerade mal ausprobiert und es funzt auch. Es soll eigentlich die Datei ausgedruckt werden ohne Word zu öffnen. Ich werde aber versuchen, dass noch herauszubekommen :-)
Auf jeden Fall vielen Dank.
Tschau
Broesis

_________________
"Wer andern eine Grube graebt ist Bauarbeiter"
G-man
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 258

Win 2000, Win ME, SuSE 8.2
D5 Standard, D6 Professional
BeitragVerfasst: Di 16.12.03 16:45 
Du kannst da auch mit OLE oder einem ShellExecutebefehl arbeiten, indem du
Word einfach eine Wert übergibst.

_________________
...To err is human, but to really foul things up requires a computer.
broesis Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19



BeitragVerfasst: Di 16.12.03 17:55 
Wenn ich dich richtig verstehe, meinst du dass man word mit den richtigen parametern startet. Gibt es irgendwo eine Liste mit den verfügbaren Parametern?

_________________
"Wer andern eine Grube graebt ist Bauarbeiter"
Licki
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 132

Knoppix, Win 95, Win 2000, Win NT, Win 98, Win XP
Delphi 3
BeitragVerfasst: Do 18.12.03 08:37 
Zu dieser Wordapplication-ServerKompo, wo Keldorn angesprochen hat. Woher bekomme ich diese? Ich habe Delphi 3? Funktioniert diese dort und wenn ja, wo kann man diese laden?

Zu dem Drucken per ShellExecute:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
var
 Datei: String; 

... 

 Datei := 'C:\Eigene Dateien\Dokument1.doc'; 
 ShellExecute(Application.Handle, 'print', PChar(Datei), nil, nil, 0);
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Do 18.12.03 08:40 
Licki hat folgendes geschrieben:
Zu dieser Wordapplication-ServerKompo, wo Keldorn angesprochen hat. Woher bekomme ich diese? Ich habe Delphi 3? Funktioniert diese dort und wenn ja, wo kann man diese laden?


Bei D5 Standard sind die serverkompos mit dabei. Ob sie in D4 schon mit dabei waren, weiß ich nicht.

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
broesis Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19



BeitragVerfasst: Do 18.12.03 16:40 
@licki:

Danke für das Bsp. per ShellExecute.

_________________
"Wer andern eine Grube graebt ist Bauarbeiter"