Creating Word documents based off templates  
Author Message

PostPosted: Visual C# General, Creating Word documents based off templates Top


I am developing using Visual Studio 2005 with C#. I am building an application that is a series of information-gathering wizards and things like that to get data from the user. Once all of the data is in, I am going to need to create a Word document based off one or more templates. The user will be able to choose a template. More than one template may need to be used to produce a single document, for example a template for the document structure itself, such as headers and footers, and another template for a specific section of the document, with a paragraph of text that has values substituted in.

I'm having a little trouble figuring out what the best way will be to do all of this programatically. The user will hit a save button and the file that gets saved will need to have all of their data in the appropriate templates, so it needs to be as automatic for the user as possible. I have started to look into the APIs available for Word, but there is a lot of information there and it's hard for me to tell what applies to my situation and what doesn't.

I'm looking for some best practices on how I can go about creating a document like this using C#. Also, I would like to know if it is necessary to have Word installed, or if I can use a DLL to get what I need.


Visual C#11  

PostPosted: Visual C# General, Creating Word documents based off templates Top

Check this example from microsoft where XML tags are used for filling documents with some data: FamilyID=ce1a79e2-87c7-4f2f-bb60-b8d34d406a48&DisplayLang=en