Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting Html to Word in .Net [closed]

I need to create a word file from a HTML content (on a ASP.NET server application) but couldn't find a robust way of doing that. So decided to run a discussion here to see what are possible options of doing this.

Aspose has a .NET component for this but the price is so high so can not be a solution (due to budgeting issues).

We expect this conversion to preserve tables, images, hiding invisible elements, links, etc.

There is a similar discussion here but solutions provided are all around Office Interop which is not a recommended solution for server application.

Any idea? Basically how do components like Aspose work?

like image 372
Mo Valipour Avatar asked Dec 12 '22 11:12

Mo Valipour


2 Answers

Has the hard work already been done? There seems to be a project on codeplex.

Blog post describing HTML to docx converter
Project on codeplex

like image 81
Robin Avatar answered Dec 27 '22 00:12

Robin


I would suggest writing code using the OpenXml API, you can navigate the DOM and programmatically add elements to the word document. Its no simple task through since you are interpretting markup and attempting to convert it.

link for Open XML: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=5124

like image 25
Glenn Ferrie Avatar answered Dec 26 '22 23:12

Glenn Ferrie