Discussion Locked

Convert MS Word to HTML using ASP

0 helpful
11 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Does anyone know of a way to convert Microsoft Word documents to HTML format using ASP or ASP.NET? Maybe with the MS Office Extensions?

Please note that it's NOT acceptable to install Word on the server. Not trying to be difficult, it's just not an option. I need to be able to do this purely through a COM object that does NOT require Word installed on the server, or through good ol' ASP or ASP.NET.

3500 points to the best answer.

Thanks,
Aaron

11 replies

by jay eckles

This isn't going to help you too much I'm afraid, but the restriction of not installing Word on the server is going to hamper your ability to perform this task. If you wanted to do this translation through ASP, you'd have to create a Word COM object using Server.CreateObject, but that's not really possible if Word isn't installed on the server. This isn't really my realm of expertise, but I'm about 80% confident that's right; if I'm wrong someone will no doubt correct me. I just wanted to let you know why you might not get many responses.

BTW, have you looked for some third-party component to do what you're trying?

Jay

by agibbs

Thanks Jay, I hope you're *not* correct :-)

Unfortunately Microsoft does not condone or recommend doing what you're saying to do -- instantiate a WORD object from a server-side scripting language like ASP. Besides that, it would require editing alot of security settings on the server to allow it to work anyway . . . generally, the anonymous user account (IUSR_SERVER) wouldn't have rights to instantiate a Word application on the server.

There are a couple folks who offer custom componentsthat do this, but they all require Word installed on the server and editing security settings to allow the IUSR account to instantiate out-of-process applications.

SoftArtisans offers an Excel component that does EVERYTHING, formulas, conversionsto HTML, all sorts of stuff -- and it doesn't require Excel installed on the server. If I could only get into their heads and figure out how they did it, surely I could duplicate it with Word . . .

by jhunsa

You don't say how many documents we're talking about nor if this is an Intranet or Internet situation. Is a manual conversion an option? Assuming you're aware of Word's "save as html" features...

Alternatively, you could write a COM component using Word.Application and programmatically invoke this operation on a second machine. This second machine could copy the converted (to html) documents to your primary server. I've written code to do this conversion. It's out of proc and somewhat problematic but it does work with hand-holding.

Finally, you could stream your Word docs into an ASP page using the stream object within ADO or the FileSystemObject. Just change the content type of your ASP page to "application/rtf" or "application/msword" (using Reponse.ContentType =). This works assuming the client machine has an rtf reader or MS Word installed locally.

Here's an interesting MSKB article outlining this technique. http://support.microsoft.com/default.aspx?scid=kb;EN-US;q301044

Jeff...

by bojidar alexandrov

I don't know what is your case, but I already have investigated with it. My case was autors that need to write articles with prety formating on an administrative site and use it to publish them on public site. Best solutions that I have found are:1. rtf2html - this is a program that makes very prety html from rtf. Word can save as rtf(Rich Text Format) file and it is standart format in text editors. Word of course can save as HTML but if you use this or through COM.... HTML from Word is the worst one that you can see :)
2. Finaly we decided to make our own component (ActiveX) for editing of HTML that originaly produce good html. It works in IE. Now we sale it separately. You can see at: http://www.HTMLXpress.com

Hope to help
Bojidar Alexandrov

by maxwell edison

"This example demonstrates how to convert basic files into HTML using Purepage SDK and Active Server Pages (ASP). You can use this example as a base to build your own code around. This sample can be found in the ASP sub-folder when you download the trial version of purepage."

See this link for the full explanation, examples, and additional links:

http://www.purepage.com/Examples/ASP/asp.html

(REMOVE SPACES from the pasted URL.)

Maxwell

This discussion is closed to new replies.