Saving the contents on a web page as .doc in c#

I want to save the contents in a file as .doc.

I have 3 text box controls,2 combo box and HTMLeditor..i want to store the data entered in this controls onto a MSword.

How can i do this do.


This can be done using Word automation. The only catch is that you need Ms Word on the server.

There is more information (no web application, but it should get you started) over here on:


Take a look at this Html to DOC One problem with this, is that for images to be shown when you'll open the doc with word, will need internet connection to show the images, because it only saves the link to the image.

But you can tweak this approach to suit your needs and if you refer to Microsoft Office HTML and XML Reference


The easy way to do this is to create a word document, and make placeholder text for the places where you want to insert your values like ##MyValue1## ##MyValue2## and so forth.

Then save it in format that outputs human readable text like xml or html.

From there all you have to do in the code is read the file in as text, do a string replace on your placeholders, and serve up the document as whatever.doc.

It is easy, and you use word to create your layout exactly how you want it, and it does not require word to be installed on the server or any other component.

One caveat, you need to inspect the xml or html that word generates to make sure it does not insert weird tags in the middle of your placeholders that would prevent your replace from finding them.

It is not recommended to use word automation unattended on a server. It is very flaky you will end up with word process that don't close properly and so on. Microsoft does not recommend it either. See this article:

Need Your Help

Wrapping an html String with JQuery


So I have made the following fiddle:

Is it possible to send POST data across domains using PHP?

php sql forms dns transfer

I have a main website (with backend SQL database), and I have satellite websites which are all separate domains. Each of these websites are hosted by a provider and have their own SQL databases, ho...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.