views:

1334

answers:

2

Is it possible to print a batch of Word documents all at one time via .Net (c# or VB, 2.0, 3.0, 3.5... language and framework above 2 doesn't matter to me)?

For example, I've got a local directory that contains several word documents... I can iterate through the list and call the PrintOut() method, but I believe that sends several print jobs. I'd like to queue them up and send one print job.

Thanks!

A: 

Yes, via Office Automation. It's COM interop, so you'll need to get comfortable with that, but the object model isn't too hard to get to grips with.

Tip: Test things out in VBA macros first to get the idea, then implement the .NET code once you've worked out what's necessary.

Neil Barnwell
To get the desired effect you'll need to merge the documents together in into one document, then print that.
Binary Worrier
Yes, recording VBA macros is very helpful, especially for beginners.
0xA3
+2  A: 

When doing Office automation VB.Net makes things much easier than C#. See this related answer.

Anyway, here is an example in C# ;-)

http://www.codeproject.com/KB/printing/WordPrinting.aspx

0xA3