473,545 Members | 2,663 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Printing Word documents with C#

Hi,

I created a C# application which opens a Word document, fills some
fields and sends the whole document to the printer. Everything is working
great but I find the printing step very slow. Each printing order takes
about 2 or 3 seconds to complete which can be long when you have 200
different documents to print.

I'm using Word because I want the users to be able to easily create some
templates containing specials fields that the application can fill with data
taken from a database. I'm using the printOut() function and the _Document
class contained in the Interop.Word.dl l library.

Does anyone knows a way to speed up the printing step ? Or prehaps
another way to fill a Word document and print it ?
Thanks and happy new year :)

Laurent
Jan 2 '07 #1
1 7538
Is there any reason you can't use mailmerge? If you want your app to
generate custom data you could have the app write the data to a
database, then have Word manage the mail merge for you (That can be
managed via code if you so desire, saving any user interaction). The
benefit is Word knows how to do mailmerge so it's quick, and it
generates one file instead of two hundred which will print faster than
creating 200 seperate documents.

If you've not tried it, have a play with mail merge in word without
worrying about the programmatic side of things so you can get a feel
for it, how it retrieves data, how fields are set up and so on.

Laurent Navarro wrote:
Hi,

I created a C# application which opens a Word document, fills some
fields and sends the whole document to the printer. Everything is working
great but I find the printing step very slow. Each printing order takes
about 2 or 3 seconds to complete which can be long when you have 200
different documents to print.

I'm using Word because I want the users to be able to easily create some
templates containing specials fields that the application can fill with data
taken from a database. I'm using the printOut() function and the _Document
class contained in the Interop.Word.dl l library.

Does anyone knows a way to speed up the printing step ? Or prehaps
another way to fill a Word document and print it ?
Thanks and happy new year :)

Laurent
Jan 2 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
359
by: sudha | last post by:
Hi I need to write a c# program which has to merge selected word documents into one word document. Kindly advise the efficient way to achieve this. Thanks in advance sudha
8
2251
by: Jason Steeves | last post by:
Can someone please point me in the right direction for displaying word documents onto a webpage? The word documents will contain text/tables/pictures. I am new to this and can't quite find what I need. Thanks,
5
1787
by: vinod | last post by:
Hi, I intend to send word documents thru mail to my clients. I don't want my clients to save the word document to there system and i don't want them to print the word documents. How can i achieve both the tasks ?
0
6292
by: mharris | last post by:
I need help with merging two Word documents into one through C# code. The problem isn't so much getting the documents put into one as it is maintaining the appropriate formatting, or rather reformating, after the merge. This is a full description of my needs. I have a C# class library that creates two Crystal Reports, and then exports them...
2
1366
by: David | last post by:
Using the article from this link, http://www.codeproject.com/aspnet/wordapplication.asp, I have been playing with generating Word documents using an ASP.NET application. The only short coming is, unlike a windows application can do, I can't have the app launch Word. Everything is being accomplished in the background (opening up a word...
7
6221
by: Dave | last post by:
Apologies for the newbie question. I have created a vb.net program for my company that is designed to work with Word Templates (about forty of them that we commonly use) that are selected by the user and populated (with info from an Access database) at run-time, then saved as Word documents. The program I have coded works fine -- it does...
3
3066
by: crashonyou | last post by:
hello again..i've been searching for quite some time now already looking for a solution to printing word documents with python..same thing for internet explorer..i was experimenting around with some code and all i came up was how to print pdf and text files with python using adobe reader 7.0 and notepad..i want to know how to do it with word and...
1
3030
by: corcoranj | last post by:
Hello everyone, I have a series of Microsoft word documents, gathered via a SQL query. I would like to be able to print these documents, no matter the number to the clients computer. I have tried several avenues like mapping to the Microsoft. Word Class, and referencing the Microsoft Word Object. I am using .NET 2003 and Framework 1.1. I have...
20
8305
MMcCarthy
by: MMcCarthy | last post by:
This problem was proposed to me but not really my area of expertise so I thought I would open it up to the forum to see if anyone had any bright ideas. The problem is generating Microsoft Word Documents on a server from Word templates and injecting data from a data source. There are a number of solutions to this problem that are less than...
0
7490
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7682
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7935
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7449
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5069
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3479
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3465
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1037
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.