View MS-Word documents in email

As shipped exmh has a built-in ability to display Microsoft Word documents using antiword [1]. If antiword is available on your path it will be used to render a plain text approximation of Microsoft Word documents in-line in the exmh message viewer. If that is not sufficient you can also integrate exmh with wvWare [2] and your browser to render Microsoft Word documents as html. This example uses wvWare with the Opera browser [3].

  1. First get and install wvWare. Doing that is outside the scope of this simple instruction page and is dependent on your operating system and/or distribution.
  2. Write a couple of simple shell scripts
  3. Test the scripts
  4. Tie it to exmh (or commandline MH/nmh)
  5. Invoke it when you want to

Write a couple of simple shell scripts

These two shell scripts ease the process. As with all shell scripts life is easier if you put them in a directory on your path.

wvHdsp

 #!/usr/bin/perl
 $res = `wvHtml --targetdir=$EXMHTMPDIR $ARGV[0] tmp.html`;
 $res = `opera-wrapper $EXMHTMPDIR/tmp.html &`;

If you don't have a setting for $EXMHTMPDIR in your environment choose a suitable temporary directory keeping in mind that a copy of the last Word document you've read will be left hanging about there.

opera-wrapper

 #!/bin/sh
 /usr/bin/X11/opera -newwindow "$1" &
 exit

Test the scripts

Before trying to access this from exmh first test that the scripts work. Starting from the bottom try the opera-wrapper script

 opera-wrapper http://www.exmh.org

If it works you'll see the exmh.org home page in a new window in your browser. Next try wvWare. You'll need a Word document for this:

 wvHtml --targetdir=$EXMHTMPDIR /path/to/your/sample.doc tmp.html

If there were no errors reported and the output of that looks OK, invoke it again via the script:

 wvHdsp /path/to/your/sample.doc

Only when you have successfully viewed a Word document using wvWare and these scripts should you proceed.

Tie it to exmh (or commandline MH/nmh)

The glue for this is an entry in your ~/.mailcap file:

 application/msword; wvHdsp %s

Invoke it when you want to

When you get a Microsoft Word document it will still be automatically shown using anti-word. But if you right-click anywhere in the document you'll see a pop-up menu. One of the choices will be View using a mailcap rule.... Choose that and a new window will be opened in your browser with the document as rendered by wvWare.



Acknowledements and notes:


Updated on 9 Mar 2003, 07:13 GMT
Search - Recent Changes - 2 References - Index - Go to Beedub's Wiki - Help