| View previous topic :: View next topic |
| Author |
Message |
Prabhat Guest
|
Posted: Wed Jun 22, 2005 2:28 pm Post subject: How to Print MS Word Document from Delphi |
|
|
Hi All,
In Delphi 5 :
How can I open a MS WORD Document (MS WORD should not be visible) and send /
print the document to Specific Printer? (not the default printer)
Thanks
Prabhat
|
|
| Back to top |
|
 |
Prabhat Guest
|
Posted: Wed Jun 22, 2005 3:39 pm Post subject: Re: How to Print MS Word Document from Delphi |
|
|
Hi,
The Question in More Detail:
I have opened one WORD Document from Delphi using "Word.Application". But
the WORD Application visible is FALSE.
1) How can I print the opened Document from Delphi using the Default
Printer?
2) How can I print the opened Document from Delphi using the User Given /
Selected Printer ?
Thanks
Prabhat
|
|
| Back to top |
|
 |
Alfred ten Hoeve Guest
|
Posted: Thu Jun 23, 2005 12:16 am Post subject: Re: How to Print MS Word Document from Delphi |
|
|
"Prabhat" <not_a_mail (AT) hotmail (DOT) com> schreef in bericht
news:42b986f4 (AT) newsgroups (DOT) borland.com...
| Quote: | Hi,
The Question in More Detail:
I have opened one WORD Document from Delphi using "Word.Application". But
the WORD Application visible is FALSE.
1) How can I print the opened Document from Delphi using the Default
Printer?
|
No Word-oleobject needed
uses ShellApi;
procedure PrintMyDoc(DocName : string);
// be sure to give DocName the standard MicrosoftWord .doc extention.
begin
ShellExecute(Handle, 'print', PChar(DocName), nil, nil, SW_HIDE);
end;
| Quote: | 2) How can I print the opened Document from Delphi using the User Given /
Selected Printer ?
|
You can get the list of available printers using the Printers property from
the TPrinter Object.
Save the index of default printer; Set the new printer to default; use
ShellExecute; set the defautlt printer back.
Alfred.
|
|
| Back to top |
|
 |
Prabhat Guest
|
Posted: Thu Jun 23, 2005 12:57 pm Post subject: Re: How to Print MS Word Document from Delphi |
|
|
Hi Alfred,
Thanks for your reply.
Can U give small example for the Changing the default printer using the
TPrinter Object?
Thanks
Prabhat
|
|
| Back to top |
|
 |
|