Convert Word to HTML on the fly

Posted on 2003-03-14
Medium Priority
Last Modified: 2007-12-19
What I’m trying to is the following...
I am trying to convert a word doc to an html file on the fly. Something like this, they upload a word doc then it opens a new page with their document now converted to HTML. Does someone have an example on how to convert or know of a good tutorial that can help me out?

Thanks in advance, Bo
Question by:vargasbo
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 8138802
Open your file and save it in html!!!

Expert Comment

ID: 8138852
If you want to automate this, here is my suggestion:

Create a simple COM object using VB6.  This object has one base method you execute with the path to the word document and a name for the html file.

The VB6 object will execute the SHELL command which will in turn execute the MS html filter for office applications on the selected word document.  This will create a clean (depending on the options configured) version of you word document in html format.

Here is a link to the MS Html filter for download and instructions for use.  If you need info or help on creating the COM object I will be glad to help.


Also, there are freeware versions of COM objects already written that would allow you to execute the html filter without writing your own object.


Author Comment

ID: 8140519
This all has to be web-base, so a simple save-as won't work. I'm a pretty new to asp so how would I call the COM object from within the Page?
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users


Expert Comment

ID: 8140799
Some host in the web have an option that all the file you uploaded will be converted to html files.  You have to choose whether you want to convert it or not.  Actually when I make a webpage to upload.  I use notepad instead of Word and save it as "filename.htm."

Accepted Solution

anderson22 earned 300 total points
ID: 8141438
A COM object is called either by its registerd class id (a guid) or by the assigned name (in Visual Basic this would be the Project Name "." Class Name).

So, if you write a visual basic object and named the project Scripting and a class within the project (you can have multiple) WebTools, your vbscript syntax would be:

Dim objShell

Set objShell = Server.CreateObject("Scripting.WebTools")
objShell.DocToHtml( strInputFile, strOutputFile )

Here is a sample class file for the VB app: (I'm not testing this so there may be sytax errors)

Dim ActiveApps As Integer
Private Declare Function GetNumTasks Lib "Kernel" () As Integer

Public Sub DocToHtml( string strInputFile, _
                      string strOutputFile, _
                      optional boolean boolA = false, _
                      optional boolean boolB = false, _
                      optional boolean boolC = false, _
                      optional boolean boolF = false, _
                      optional boolean boolL = false, _
                      optional boolean boolM = false, _
                      optional boolean boolO = false, _
                      optional boolean boolR = false, _
                      optional boolean boolS = false, _
                      optional boolean boolT = false, _
                      optional boolean boolV = false, _
                      optional boolean boolX = false)
    Dim strCommand As String
    Dim Y As Integer
    Dim X As Integer
    ActiveApps = GetNumTasks()
    strCommand = "filter "
    if boolA then
        strCommand = strCommand & " -A"
    end if
    if boolB then
        strCommand = strCommand & " -B"
    end if
    if boolC then
        strCommand = strCommand & " -C"
    end if
    if boolF then
        strCommand = strCommand & " -F"
    end if
    if boolL then
        strCommand = strCommand & " -L"
    end if
    if boolM then
        strCommand = strCommand & " -M"
    end if
    if boolO then
        strCommand = strCommand & " -O"
    end if
    if boolR then
        strCommand = strCommand & " -R"
    end if
    if boolS then
        strCommand = strCommand & " -S"
    end if
    if boolT then
        strCommand = strCommand & " -T"
    end if
    if boolV then
        strCommand = strCommand & " -V"
    end if
    if boolX then
        strCommand = strCommand & " -X"
    end if

    strCommand = strCommand & " " & strInputFile & " " & strOutputFile

    X = Shell( strCommand, 5 )
    Do While GetNumTasks() <> ActiveApps
        Y = DoEvents()
End Sub

MSDN reference to Shell Command:


Author Comment

ID: 8141477
thanks for all the help, I have a solid place to start from now.

Expert Comment

ID: 8171160
What about giving the users Macromedia's Contribute and letting them drag and drop their Word files straight into the web pages? The html code it creates is about the same as what  you get from a SaveAs from Word 2000. Not exactly clean code but it works in post-version 4 browsers.
M Child

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
When it comes to security, close monitoring is a must. According to WhiteHat Security annual report, a substantial number of all web applications are vulnerable always. Monitis offers a new product - fully-featured Website security monitoring and pr…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

770 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