tags:

views:

42

answers:

1

Application we developed fills MS Word templates with data from Database. Customers require to have ability edit Word templates via MS Word (change style, font, layout e.t.c) with no additional software to be installed and no training.

AFAIK, Sql Reporting Services and Crystal Reports can't populate MS Word templates produced in MS Word. So we implemented our custom solution that maps .net classes onto xml-saved MS Word documents. It looks like we declare

class MyTemplate
{
   // maps to [age] field declared in ms document straight in the text 
   int Age { get; set; }

   // maps to table by attributes applied to property (omitted)
   List<Person> Persons { get; set; }
}

We also implemented images insertion.

Are there any free libraries for this task or may be you use your own MS-word templators in your projects?

A: 

I've always used MS Word's Mail Merge features for this sort of thing: Word can connect to a large number of data sources (Excel, CSV, SQL Server, ODBC etc), so it's usually possible to get the data required into a format that it can accept. Then it's fairly easy to create a mail merge document, and insert the database fields where required using a drop-down list.

psmears
Thank you, I'll take a look
Andrew Florko