Generating Word Documents through C# Application

C

chandra

Hi all,

Does anyone know how to generate collection of word documents through a .NET
C# application?
The documents have the same template (.dot). The C# application should put
some data at the bookmarks in the template.


Thanks in advance
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?Y2hhbmRyYQ==?=,
Does anyone know how to generate collection of word documents through a .NET
C# application?
The documents have the same template (.dot). The C# application should put
some data at the bookmarks in the template.
Sure, I've been there, done that. Where are you stuck? You need
the Document.Add method (with all those Ref object nasty parameters).
Roughly:
Word.Document doc = wdApp.Documents.Add(list of params);

Then you can address the bookmarks by name, or loop through them. Roughly:
object bkmName = "Name";
Word.Bookmark bkm = doc.Bookmarks.get_item(ref bkmName);
bkm.Range.Text = "Data that goes in the bookmark";

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top