我擅長印刷這樣的:html to excel問題!
header("Content-Type: application/vnd.ms-excel; charset=utf-8");
header("Content-type: application/x-msexcel; charset=utf-8");
header("Content-Disposition: attachment; filename=".str_replace(' ', '_', $title).".xls");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
內容是純HTML。這個問題,當我下載這個,我得到一個初始確認框書面
The file you are trying to open 'File_name.xls', is in a different format than specified by the file extension. Verified that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?
當我做「是」,我得到這個。有點奇怪,請在這裏輸入任何朋友嗎?
哪種語言asp.net,php,asp,cold fusion ...等 – 2011-04-25 17:02:21
我不確定我是否理解你在「打印」這個xls文件。從我的理解中可以看出,你是不是寫了一個擴展名爲xls的HTML文件? – keepitreall89 2011-04-25 17:04:32
@geek,它的PHP。 @ keepitreal89,是的,它是使用php從mysql獲取的數據,然後使用html表格顯示。 – 2011-04-25 18:16:32