开发者

Reporting. MS Word templates population required

Application we developed fills MS Word templates with data from Database. Customers require t开发者_开发问答o 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?


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.


I think for what you are doing (I may not be understanding your question correctly) you should be able to use OpenXML. You can read it all in, populate the nodes, and write it back out.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜