ADO.NET and Word XP (2002)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

Can anyone give me an example of setting a MS Word Mail Merge datasource to a DataTable. Is this even possible in 2002 or do I need to upgrade to 2003. Any assistance is very much appreciated

Todd
 
Hi Todd,

Check out this article:
HOWTO: Automate Microsoft Word to Perform Mail Merge from Visual C# .NET
http://support.microsoft.com/default.aspx?scid=kb;en-us;301659&Product=vcSnet

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Todd said:
Hi,

Can anyone give me an example of setting a MS Word Mail Merge datasource
to a DataTable. Is this even possible in 2002 or do I need to upgrade to
2003. Any assistance is very much appreciated.
 
¤ Thanks, Miha.
¤
¤ I have seen this example, and it has provided me with a very good example of the Word mail merge objects. However, this example does not use ADO.NET datasets or tables, which is really what I am trying to do.
¤
¤ Do you know of any examples with this?
¤
¤ I have seen the details of the "MailMerge.CreateDataSource" method, and I will try to manipulate some of the properties on this, but I don't want to waste time if it just cannot be done with Word XP.

It would seem to me that all you need to do is replace the FillRow related code (which is hard-coded
in the example) using ADO.NET code. Is this what you are looking to do?

You can't really change the other MailMerge functionality as it is essentially built into the Word
object model.


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Thanks for your reply, Paul

I guess what I am trying to avoid is moving the data to another repository, such as another Word Document, after I have already filled my dataset table. I would like to "bind" my DataTable to the mail merge data source. Doing so would give me some significant performance gains when working with large sets of data

I noticed that MailMerge.CreatDataSource has "Connection" and "SQL Statement" properties. I was going to try to use these to mail merge directly to my OLEDB data source. Do you think that will work

Todd.
 
I don't think it will work.

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Todd said:
Thanks for your reply, Paul.

I guess what I am trying to avoid is moving the data to another
repository, such as another Word Document, after I have already filled my
dataset table. I would like to "bind" my DataTable to the mail merge data
source. Doing so would give me some significant performance gains when
working with large sets of data.
I noticed that MailMerge.CreatDataSource has "Connection" and "SQL
Statement" properties. I was going to try to use these to mail merge
directly to my OLEDB data source. Do you think that will work?
 
¤ Thanks for your reply, Paul.
¤
¤ I guess what I am trying to avoid is moving the data to another repository, such as another Word Document, after I have already filled my dataset table. I would like to "bind" my DataTable to the mail merge data source. Doing so would give me some significant performance gains when working with large sets of data.
¤
¤ I noticed that MailMerge.CreatDataSource has "Connection" and "SQL Statement" properties. I was going to try to use these to mail merge directly to my OLEDB data source. Do you think that will work?

You can bind your DataTable to the data source independent of the mail merge (although I'm not sure
what your data source is). The only purpose of the mail merge with respect to using Microsoft Word
is that it provides you with a formatted document consisting of the data.

If all you need is the data then you don't need to use mail merge.


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
Back
Top