After export excel file from php, excel 2010 is not openning it

I have an script written in php that export a html table to excel using MIME types.

Since yesterday 2016/07/20, excel 2010 is not openning any more file from my web site and I notice that is not openning form any other web site that do the same exportation

This is a test code

<?php
header('ContentType : application/vnd.ms-excel');
header('Content-Disposition : attachment;filename=test.xls');
header('Pragma : no-cache');

$out = "
<table>
    <tr>
        <td>something 1</td>
        <td>something 2</td>
        <td>something 3</td>
        <td>something 4</td>
        <td>something 5</td>
    </tr>
</table>
";

echo $out;
?>

The code is still working but any excel 2010 is openning this file

thanks

Upvotes: 0

Views: 1215

Answers (2)

Gil
Gil

Reputation: 11

There was a recent (7/12/2016) MS Excel security update. Do the following to view the files in Excel:

  1. Open an Excel sheet
  2. Navigate to File -> Options -> Trust Center -> Trust Center Settings -> Protected View
  3. Un-Check "Enable Protected View for file originating from the Internet".
  4. Reopen the files.

I haven't found any permanent fix for this to continue to allow HTML->XLS viewing within Excel.

Upvotes: 1

Stas Coder
Stas Coder

Reputation: 347

I see from format of the file that it's .xls, which is from Excel 2003. There is a support issue in Microsoft site - here is a link. Perhaps it's because of your Excel program, but not your site.

Upvotes: 0

Related Questions