Solved

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

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now