How to get Microsoft office files downloaded properly through Drupal

I recently came across situation where the .ppsx files were displayed as some weird characters instead of getting downloaded. For those who aren't aware of the .ppsx file extension, it is nothing but the extension for files created through Microsoft PowerPoint. You can find more information about the Powerpoint file formats here.

Let me elaborate on the issue I faced with .ppsx files in Drupal. We had a content type with a file field and used to upload .pdf, .ppsx, .doc, etc. We didn't have any problem while downloading .pdf files, but in the case of .ppsx files some weird characters were shown.

The solution for the problem is to add some information about the MIME types in the .htaccess file. Here are the lines that need to be added to .htaccess file:

AddType application/ docm
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx
AddType application/ potm
AddType application/vnd.openxmlformats-officedocument.presentationml.template potx
AddType application/ ppam
AddType application/ ppsm
AddType application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
AddType application/ pptm
AddType application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
AddType application/ xlam
AddType application/ xlsb
AddType application/ xlsm
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
AddType application/ xltm
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx

This would address the issue for most of the microsoft office files.

Add new comment

The content of this field is kept private and will not be shown publicly.