Looking for a command line Html to word converter program

P

Pedro

Hello:

I've been trying to find a program that:

1. converts HTML to DOC.
2. Accepts command line instructions
3. Is a self-contained executable, and doesn't open a GUI when launched
via comman line.

Does anyone know of such a tool?

Thanks in advance.
 
M

Michael Bednarek

I've been trying to find a program that:

1. converts HTML to DOC.
2. Accepts command line instructions
3. Is a self-contained executable, and doesn't open a GUI when launched
via comman line.

Does anyone know of such a tool?

You can easily make one yourself with on-board tools. The following WSH
script might get you started:

Option Explicit
Dim objWRD
Const wdFormatDocument = 0

Set objWRD = WScript.CreateObject("Word.Application")
objWRD.Documents.Open WScript.Arguments(0)
objWRD.ActiveDocument.SaveAs WScript.Arguments(1), wdFormatDocument
objWRD.Quit

When saved as, say HTMtoDOC.VBS, invoke it with
CSCRIPT HTMtoDOC d:\path\file.HTML d:\path\file.DOC

As it stands, it requires the full path for both arguments (unless your
documents are in Word's DefaultFilePath(wdDocumentsPath) - which is
usually %USERPROFILE%\My Documents). Including the WScript.Shell
property CurrentDirectory in the Open and SaveAs methods, you can make
it operate on files in the current directory.
 
P

Pedro

Michael:

Thaks for the reply. Sounds like a good start. My goal is actually to
do this file conversion on my web hosting provider's IIS web server (in
which, of course, I have no administrative privileges). However, I can
run simple executables on it. As far as you know, can Word objects be
called on a web server using ASP / VBscripting?
 
M

Michael Bednarek

Michael:

Thaks for the reply. Sounds like a good start. My goal is actually to
do this file conversion on my web hosting provider's IIS web server (in
which, of course, I have no administrative privileges). However, I can
run simple executables on it. As far as you know, can Word objects be
called on a web server using ASP / VBscripting?

WScript.CreateObject("Word.Application") will only work on systems where
Microsoft Word is installed. In your case, a dedicated utility might do
the job, although I'd be suspicious of the capacity of any such program
to understand whatever Word might throw at them.

If I had to deal with this request, I would download the files to a
machine with Word installed, convert them using Word, and upload them
again.

Alternatively, if you have control over the production of the Word
files, Word 11 (2003) lets you save documents as HTML files, or as XML
files which can be viewed in IE with wmlview.exe
(<http://www.microsoft.com/Downloads/...18-1BCD-4852-93BA-0B5A203EA731&displaylang=en>).

Even better would be to create PDF files from the Word documents using a
free or cheap PDF tool (I prefer PDFCreator); this would also avoid the
troublesome area of meta data in the Word documents which might not be
suitable for public consumption.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top