Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is best solution to generate Word document from ASP.NET? [closed]

I would like to generate a word document from my ASP.NET application. Currently we show an "Agenda List" which is the agenda information and all items/subjects. This page needs to have the ability to open in word. The agenda page is not static, it's a dynamic list of agenda items pulled from SQL Server.

Any suggestions on the best solution? I'm looking for a quick solution and OpenXML seems to be a bit too time consuming. I'm open to purchasing third party tools.

Thanks!

like image 285
Nathan Hall Avatar asked Apr 13 '13 15:04

Nathan Hall


2 Answers

Use the Office OpenXML SDK. For later versions of Office (2007 and above), this is the standard. There are other ways as mentioned in other answers, but OpenXML will give you the greatest level of control over the output.

Here is some documentation to get you started: http://msdn.microsoft.com/en-us/office/bb265236.aspx

like image 86
James Johnson Avatar answered Oct 19 '22 23:10

James Johnson


You can either

  1. Let the page generate the document yourself (like RTF format)

  2. Save the Word template as XML and add your own placeholder where you fill in the content (I know you said this is time consuming which is true if you do a lot of updates to the template)

  3. Used 3rd party tool like Aspose (http://www.aspose.com), it worked very well for me as it does save a lot of time to work with the document through objects in C#.

like image 21
Andrej K Avatar answered Oct 20 '22 01:10

Andrej K