TIP MsOfficeAttachmentsAsHTMLPlugin is not installed on Foswiki.org.


Changes attached DOC files into HTML files and then replaces the content of the topic with an include to the HTML source

Note: a version of this extension is available for use with TWiki. Please contact Foswiki:Main.CrawfordCurrie for details on how to retrieve it.


Attach a .doc file to a topic, and it will automatically generate a .html version of the attachment. If the topic text contains the magic setting:
then the topic content will automatically be replaced by an include of the (HTML) content of the attachment, using the following template:
  • Set REPLACEMENTNOTE = This text was automatically generated from the attachment $attachment
This site does not allow %INCLUDE% of URLs

Installation Instructions

This package requires a convertor that can convert from Word documents to HTML. Candidates are wvHtml and AbiWord

You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.

Open configure, and open the "Extensions" section. Use "Find More Extensions" to get a list of available extensions. Select "Install".

If you have any problems, or if the extension isn't available in configure, then you can still install manually from the command-line. See http://foswiki.org/Support/ManuallyInstallingExtensions for more help.

Run configure and if necessary adjust the pathname to the convertor program.

There is one other important setting accessible through configure; $Foswiki::cfg{Plugins}{MsOfficeAttachmentsAsHTMLPlugin}{filters}. This is an array of (perl) regular expression substitutions that the generated HTML document is processed through. This allows you to rewrite sections of the HTML to remove Microsoft Word features. By default there is a single expression, which rewrites image links in the HTML to refer to the topic attachment directory.

Note that any Foswiki macros in the rewriting rules are expanded before the rule is applied. Be careful that the expansion of any such macros doesn't add new regular-expression meta-characters.


Author(s): Martin Cleaver Martin@Cleaver.org
Copyright: © 2003 Martin@Cleaver.org
© 2009 Crawford Currie http://c-dot.co.uk
License: GPL (Gnu General Public License)
Version: 3575 (2009-04-20)
Change History:  
20 Apr 2009 Foswikitask:Item8123: added URL rewriting
3 Feb 2009 Foswikitask:Item891: Ported to Foswiki, vastly simplified and enhanced, back-ported to TWiki (Crawford Currie)
Home page: http://foswiki.org/bin/view/Extensions/MsOfficeAttachmentsAsHTMLPlugin

Topic revision: r5 - 17 Aug 2009, CrawfordCurrie
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy