Learn how to a build a cloud-first strategyRegister Now


HTML to WordML -- and vice versa

Posted on 2004-11-23
Medium Priority
Last Modified: 2008-03-04
How do I create a standalone application that opens an HTML file as a Word document? Also, how do I later save this Word document into HTML? I want to be able use Word's functionality, if possible. I tried adding a Word reference to my project, but could not declare such an object:

' squiggly line under "Word"
Dim objWord as Word

I figured I might be able to use Word's methods and properties to do this.
Question by:xmlnewbie
  • 2
LVL 10

Accepted Solution

anv earned 200 total points
ID: 12661899

here's the code to convert a word document to html

void DocToHtml(string docPath,string htmlPath)
Word.Application app=new Word.Application();
Object o=Missing.Value;
object docFile=docPath;
_Document doc=app.Documents.Open(ref docFile,ref o,ref o,ref o,ref o,ref o,ref o,ref o,ref o,ref o,ref o,ref
object fileName=htmlPath;
object format=8;//Html
doc.SaveAs(ref fileName,ref format,ref o,ref o,ref o,ref o,ref o,ref o,ref o,ref o,ref o);
object t=true;
app.Quit(ref t,ref o,ref o);

Author Comment

ID: 12661906
What does that mean??
LVL 10

Expert Comment

ID: 12661916
also u can check the link below:

for further details


its for the same as above.

Expert Comment

ID: 14436838
OK so this converts from Word to HTML. How do you convert from HTML to WordML? I'ma ssuming the only change is the format # but I don't know what that is.

Also, is there a way to do this without loading the WINWORD.EXE COM object?

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Integration Management Part 2
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question