We are using the &outputType=xls parameter from a CDA query to export an Excel file for our users.

This works fine for most users, but on a few users Safari browsers the exported file is adding .html on the end, so that the final file downloaded is "myreport.xls.html".

In some cases this prevents the download and the browser just goes to a nasty looking code page.

Checking on the web it would appear that the header needs to be set to

header('Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');