Solved

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

Posted on 2004-03-22
4
563 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

Independent Software Vendors: 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

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month11 days, 11 hours left to enroll

623 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