Solved

Printing amount of copies of Word Document from Delphi-app ...

Posted on 2004-03-22
4
554 Views
Last Modified: 2010-04-05
Hi experts,

I want to print a word-document from my delphi-application (preferable is that Word itself won't open).
I want to be able to dynamically determine the documentname and number of copies to print.
Please feed me with some code if possible.
Thanks in advance,

The Mayor.
0
Comment
Question by:wimmeyvaert
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10652719
Take a look at the TWordApplication component on the servers tab of the component palette

  WordApplication1.Connect;
  WordDocument1.PrintOut();  //here is where you decribe all your parameters example: copies
  WordApplication1.Disconnect;
  WordApplication1.Quit;

Shane
0
 
LVL 11

Accepted Solution

by:
shaneholmes earned 125 total points
ID: 10652725
0
 
LVL 6

Author Comment

by:wimmeyvaert
ID: 10664918
Hi shaneholmes,

I will take a closer look at the example.
I'll be back ...

Best regards,

The Mayor.
0
 
LVL 6

Author Comment

by:wimmeyvaert
ID: 10665119
Hi shaneholmes,

It works !!!!
I looked at the URL you gave in your second comment. Ther I found the complete anwser to my question.

This is the solution I used :

var
 DocFile, PrnFile,
 Background, Append, Range, OutputFileName,
 From, To_, Item, Copies, Pages, PageType,
 PrintToFile, Collate, FileName,
 ActivePrinterMacGX, ManualDuplexPrint: OleVariant;
 Doc, Word : OleVariant;
begin
 DocFile := 'C:\test.doc';
 PrnFile := 'c:\test.prn';
 Word := CreateOleObject('Word.Document.6');
 Background := False;
 Append := EmptyParam;
 Range := 0;
 OutputFileName := PrnFile;
 From := '';
 To_ := '';
 Item := 0;
 Copies := 1;
 Pages := '1';
 PageType := 0;
 PrintToFile := True;
 FileName := DocFile;
 Collate := EmptyParam;
 ActivePrinterMacGX := EmptyParam;
 ManualDuplexPrint := EmptyParam;
 word.Application.Visible := false;

 Word.Application.PrintOut(Background,
                        Append,
                        Range,
                        OutputFileName,
                        From,
                        To_,
                        Item,
                        Copies,
                        Pages,
                        PageType,
                        PrintToFile,
                        Collate,
                        FileName,
                        ActivePrinterMacGX);


Thanks a lot for the fast response !

Best regards,

The Mayor.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Dynamically Created Query 3 69
Graphics32 under Delphi 10.1 Berlin 2 124
RESTRequest Parameter 4 51
Slow Restore if incremental backups using RDiff.exe 4 39
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question