Wednesday, February 24, 2010

Adding mime types for Microsoft Office 2007 file types in Apache

When opening uploaded documents from Microsoft Office 2007 applications in MediaWiki (and some other web applications as well) they might turn up as zip-files or doesn't start the appropriate office application. This is due to the fact that Office Open XML (OOXML) is a zip based file format and Apache 1 and 2 doesn't yet come with updated mime type definitions (or IANA haven't registered them).

You can add these missing definitions yourself without much trouble. First locate the Apache mime types table (mime.types) and then just add the following and restart your apache server.

application/vnd.ms-word.document.macroEnabled.12 docm
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx
application/vnd.ms-powerpoint.template.macroEnabled.12 potm
application/vnd.openxmlformats-officedocument.presentationml.template potx
application/vnd.ms-powerpoint.addin.macroEnabled.12 ppam
application/vnd.ms-powerpoint.slideshow.macroEnabled.12 ppsm
application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
application/vnd.ms-powerpoint.presentation.macroEnabled.12 pptm
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
application/vnd.ms-excel.addin.macroEnabled.12 xlam
application/vnd.ms-excel.sheet.binary.macroEnabled.12 xlsb
application/vnd.ms-excel.sheet.macroEnabled.12 xlsm
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
application/vnd.ms-excel.template.macroEnabled.12 xltm
application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx

For MediaWiki to identify the correct mime type (during upload) you can also add the above unmodified to includes/mime.types.

The MediaWiki file includes/mime.info has no practical use currently but you could add the following to it for completeness:

application/vnd.ms-word.document.macroEnabled.12 [OFFICE]
application/vnd.openxmlformats-officedocument.wordprocessingml.document [OFFICE]
application/vnd.openxmlformats-officedocument.wordprocessingml.template [OFFICE]
application/vnd.ms-powerpoint.template.macroEnabled.12 [OFFICE]
application/vnd.openxmlformats-officedocument.presentationml.template [OFFICE]
application/vnd.ms-powerpoint.addin.macroEnabled.12 [OFFICE]
application/vnd.ms-powerpoint.slideshow.macroEnabled.12 [OFFICE]
application/vnd.openxmlformats-officedocument.presentationml.slideshow [OFFICE]
application/vnd.ms-powerpoint.presentation.macroEnabled.12 [OFFICE]
application/vnd.openxmlformats-officedocument.presentationml.presentation [OFFICE]
application/vnd.ms-excel.addin.macroEnabled.12 [OFFICE]
application/vnd.ms-excel.sheet.binary.macroEnabled.12 [OFFICE]
application/vnd.ms-excel.sheet.macroEnabled.12 [OFFICE]
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet [OFFICE]
application/vnd.ms-excel.template.macroEnabled.12 [OFFICE]
application/vnd.openxmlformats-officedocument.spreadsheetml.template [OFFICE]

Finally remember to add the file types to the variable $wgFileExtensions in LocalSettings.php.

6 comments:

  1. Personally it seems to me that this version of the software is too outdated and better updated to a more recent version of this program, I personally have already done it and the only thing I do not like is the amount of standard templates. Personally, I download them herehttps://poweredtemplate.com/sports-ppt-powerpoint-templates.html. I recommend to everyone.

    ReplyDelete
  2. The strength and knowledge of a Microsoft Certified Master begins with an experienced-based training based on their curriculum that is built on, by the foundation of expert-level classroom trainees.
    MCSE Training London

    ReplyDelete
  3. Looking forward to reading more. Great article.Really looking forward to read more. Awesome. microsoft toolkit 2.6.6 download free

    ReplyDelete
  4. Given the overwhelming number of office desks available in the market, most buyers use some kind of shopping strategy to make the right choice. divisorias para escritorio preço

    ReplyDelete
  5. Informative post, thank you for sharing how to add this. Reading lengthy instructions from long, official resources like office.com/setup is time-consuming. Your work is really commendable.

    ReplyDelete