Reputation: 575
I need to generate some word/excel documents (invoices, contracts, reports) in .NET application (ASP.NET MVC, if it does matter) from templates. So, is it possible to design template with placeholders and control blocks (i think if and foreach will be enough for my purposes) in word/excel, and then use POCO (or XML, if any xslt-like engines are exists) objects as datasource render documents from temlate? In other words i am trying to find free or opensource word/excel template engine like NVelocity. May be any way to do this with openxml SDK are exists?
Thanks.
Upvotes: 3
Views: 6525
Reputation: 19828
The easiest way is to use Microsoft Office XML. There is both XML format for Excel and Word. Because it is a normal XML file you could use all .NET stuff for XML's including LINQ to XML, XSLT, string operations etc.
If you cannot use Office XML you could try external libraries like:
Upvotes: 3
Reputation: 73
You could use the open xml package provided by .Net. I put a nice wrapper around it for Excel, check my open project: http://officehelper.codeplex.com/documentation
Upvotes: 0