Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2004-03-22
4
Medium Priority
?
573 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
  • 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 500 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

824 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