Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word Integration with a .NET app

Status
Not open for further replies.

MasterRacker

New member
Oct 13, 1999
3,343
US
I have a situation where I will have a C# app doing a query on a DB to get a list of users. I need to use that user list as the source of a MailMerge for Word.

Can the contents of a DataTable be fed directly into Word for this? If I performed the kludge of copying the table into Excel, would that sheet have to be saved before Word could use it? (Worse would the user have to actually run through the MailMerge wizard?)

In the ideal situation, I wuold like to end up with the user clicking a single button in the C# app, latting magic happen, and having Word pop up with the finished mailmerge with no other user interaction.

Also I would like to avoid any VBA in the letter templates since there will be more than one and I don't want to have to copy code into multiple templates.


Jeff
The future is already here - it's just not widely distributed yet...
 
The Office XP PIA's are available here:


I believe that they will work with Office 2000 and 2003. Note that once you install them, you will not see them in the .NET portion of the add reference dialog. You will still add a reference under the COM tab to MS Word.

Here is a good article on getting started with the Office object model:


There is a promising mention of a macro recorder by which you perform the steps with the UI you intend to code and then see what methods/properties need invoked to perform those steps.

I am fairly certain that you would need to save the data to a file first.
 
Thanks.

Another approach I thought of I may try first will avoid Word altogether. Since Crystal Reports is built in to Visual Studio, I may try to generate the letters through that querying against a DataSet.


Jeff
The future is already here - it's just not widely distributed yet...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top