Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > สงสัยเกี่ยวกับ MIME Type : header("Content-type: application/vnd.ms-excel"); และ header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); ครับ



 

สงสัยเกี่ยวกับ MIME Type : header("Content-type: application/vnd.ms-excel"); และ header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); ครับ

 



Topic : 083786



โพสกระทู้ ( 406 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook



สงสัยเกี่ยวกับ MIME Type : header("Content-type: application/vnd.ms-excel"); และ header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); ครับ

ผมลองโค๊ด Report Excel 2003 (.xls) จากโค๊ดด้านล่าง จะสามารถใช้งานได้ นะครับ

แต่ผมลองเปลืยน MIME Type : header เป็นชนิด .xlsx ไม่ทำงานครับ

ผมอยากได้โค๊ดแบบ Report Excel 2003 (.xls) แต่เป็น Report Excel 2007 2010 (.xlsx)


Ex. Report Excel 2003 (.xls)
Code (PHP)
<?php
$spreadsheet = date("mdy");

header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=$spreadsheet.xls");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
header("Pragma: public");
?>
<html xmlns:x="urn:schemas-microsoft-com:office:excel">
<head>
<title></title>
<style>
<!--table
@page
{mso-header-data:"&CMultiplication Table\000ADate\: &D\000APage &P";
mso-page-orientation:landscape;}
br
{mso-data-placement:same-cell;}

-->
</style>
<!--[if gte mso 9]><xml>
<x:ExcelWorkbook>
<x:ExcelWorksheets>
<x:ExcelWorksheet>
<x:Name>Sample Workbook</x:Name>
<x:WorksheetOptions>
<x:Print>
<x:ValidPrinterInfo/>
</x:Print>
</x:WorksheetOptions>
</x:ExcelWorksheet>
</x:ExcelWorksheets>
</x:ExcelWorkbook>
</xml><![endif]-->
</head>
<body>
<table border="1">
<tr>
  <th>Name</th>
  <th>SurName</th>
  <th>Address</th>
</tr>
<tr>
  <th>&nbsp;</th>
  <th>&nbsp;</th>
  <th>&nbsp;</th>
</tr>
</table>
<body>
</html>


อ้างอิง

http://technet.microsoft.com/en-us/library/ee309278%28v=office.12%29.aspx

http://filext.com/faq/office_mime_types.php



Tag : PHP, HTML/CSS, CakePHP, Excel (Word.Applcaition), Reporting Service, Report Others









ประวัติการแก้ไข
2012-09-11 10:07:14
2012-09-11 10:19:12
Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-09-11 10:06:18 By : nattkhanesha View : 3384 Reply : 4
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ก็ใช้ xls ปกติครับ มันก็เปิดกับ Excel 2007 ได้เช่นเดัยวกันครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-09-12 12:25:24 By : mr.win
 


 

No. 2



โพสกระทู้ ( 406 )
บทความ ( 0 )



สถานะออฟไลน์
Facebook

ผมลองใช้คำสั่ง header .xlsx แล้วเปิดโปรแกรม Microsoft Office Excel 2007 ไม่ได้ครับ

Code (PHP)
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header("Content-Disposition: attachment; filename=$spreadsheet.xlsx");

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-09-12 12:57:53 By : nattkhanesha
 

 

No. 3



โพสกระทู้ ( 368 )
บทความ ( 0 )



สถานะออฟไลน์


รบกวนพี่วิน ช่วยตอบคำถามนี้หน่อยครับ ผมเองก็อยากรู้เหมือนกันครับว่าทำได้หรือไม่
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-11-20 11:55:21 By : beer656
 


 

No. 4



โพสกระทู้ ( 368 )
บทความ ( 0 )



สถานะออฟไลน์


รบกวนช่วยตอบหน่อยครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-11-20 13:26:08 By : beer656
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : สงสัยเกี่ยวกับ MIME Type : header("Content-type: application/vnd.ms-excel"); และ header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); ครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 03
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่