问题描述:

I am using PHP to dynamically generate a table which the user can download as a .xls file. When the using IE, after clicking the link, the "Do you want to open or save the file..." dialog pops up. If the user saves the file and opens it, there is no problem. But if the user chooses 'Open', Excel launches, but it is empty. There is no spreadsheet. Everything works fine in Chrome and FF.

Here is the code I'm using.

<?PHP

// filename for download

$filename = "filename" . date('M_j_Y') . ".xls";

//create the output

$output = //<table> code goes here.

//set the header to treat this as an excel file

header("Content-Disposition: attachment; filename=\"$filename\"");

header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");

header("Expires: 0");

header("Cache-Control: must-revalidate, post-check=0, pre-check=0");

header("Cache-Control: private",false);

echo $output;

exit;

?>

This is what happens when I click the link to download the spreadsheet and then choose 'Open' from the IE10 dialog.

Any advice on how to make the spreadsheet open when an IE user clicks 'Open' would be greatly appreciated. Thanks.

网友答案:

you can try this:

a. Right click on the file and choose Properties b. On the General tab, click Unblock c. Click OK

Check this link: https://support.microsoft.com/en-us/kb/3181507

网友答案:

Microsoft's documentation suggests that the issue may actually be a setting in Excel -- that Excel may be ignoring Dynamic Data Exchange (DDE) information from IE. Might check the setting described and see if that's it.

相关阅读:
Top