Welcome to WebmasterWorld Guest from 54.224.44.168

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Serving Microsoft Office 2007 documents from Apache

Open XML mime type set up

     
11:19 pm on Jan 2, 2008 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12548
votes: 2


Microsoft Office 2007 introduced some new file types and file extensions (MS to change Office file formats June 2005 [webmasterworld.com]). Anybody serving documents from Apache may run into user issues where either the file is displayed in binary format in the browser or perhaps brought down as an archive (.zip). The nature of the document is that it is indeed zipped, hence the browser wanting to parse as such.

I wasn't certain what the mime types were, so I went searching and located a document on a Microsoft TechNet Japan site, an article that states ...

In order for servers to recognize the new file formats, you will need to register the Multipurpose Internet Mail Extensions (MIME) types for each new file type. If the MIME types are not registered, servers will detect the new file formats as ZIP archives. MIME types are automatically registered with Windows Server 2003 Service Pack 2 (SP2).

I don't run IIS and I am uncertain how else to locate the MIME types other than the tools provided via the IIS Manager (Viewing Available MIME Types [technet2.microsoft.com]), so I just used the list from the article (cited below).

Well, down to the nuts and bolts of it all. There are two things you can do. First, you could update the Apache conf/mime.types [localhost] file by adding the extensions but that is not recommended by Apache as you may lose the updates on your next server upgrade. The mime.types file will likely get replaced. The recommended option is to use the AddType [httpd.apache.org] directive. Updating your httpd.conf is the recommended route, but you could also do this in a per-directory override file (.htaccess). Here is the code I dropped in to resolve the issue:

AddType application/onenote                                                         onetoc onetoc2 onetmp onepkg 
AddType application/vnd.ms-excel.addin.macroEnabled.12 xlam
AddType application/vnd.ms-excel.sheet.binary.macroEnabled.12 xlsb
AddType application/vnd.ms-excel.sheet.macroEnabled.12 xlsm
AddType application/vnd.ms-excel.template.macroEnabled.12 xltm
AddType application/vnd.ms-powerpoint.addin.macroEnabled.12 ppam
AddType application/vnd.ms-powerpoint.presentation.macroEnabled.12 pptm
AddType application/vnd.ms-powerpoint.slide.macroEnabled.12 sldm
AddType application/vnd.ms-powerpoint.slideshow.macroEnabled.12 ppsm
AddType application/vnd.ms-powerpoint.template.macroEnabled.12 potm
AddType application/vnd.ms-word.document.macroEnabled.12 docm
AddType application/vnd.ms-word.template.macroEnabled.12 dotm
AddType application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
AddType application/vnd.openxmlformats-officedocument.presentationml.slide sldx
AddType application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
AddType application/vnd.openxmlformats-officedocument.presentationml.template potx
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx

Resources:
Introducing the Office (2007) Open XML File Formats [msdn2.microsoft.com]

Register file extensions on third party servers [technet2.microsoft.com]
A Microsoft TechNet Japan Article. The only definitive listing I could find!

If anybody knows of a better way of locating these MIME application types and extensions from Microsoft outside of the article cited, please advise!