Everybody knows phpMyAdmin can export file to Excel format but phpMyAdmin just export .csv file,not real Excel file format. If you are interest in PHP programming and need to export to the real Excel format please check it out !
Example PHP export to XLS file format.
1. Create Function for XLS
function xlsBOF() { |
2. Send Header to Browser in download format.
// Query Database $result=mysql_db_query($dbname,"select id,prename,name,sname,grade from appdata where course='$courseid' and sec='$section'") // Send Header header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Content-Type: application/force-download"); header("Content-Type: application/octet-stream"); header("Content-Type: application/download");; header("Content-Disposition: attachment;filename=$courseid-$sec.xls "); header("Content-Transfer-Encoding: binary "); // XLS Data Cell xlsBOF(); xlsWriteLabel(1,0,"Student Register $semester/$year"); xlsWriteLabel(2,0,"COURSENO : "); xlsWriteLabel(2,1,"$courseid"); xlsWriteLabel(3,0,"TITLE : "); xlsWriteLabel(3,1,"$title"); xlsWriteLabel(4,0,"SETION : "); xlsWriteLabel(4,1,"$sec"); xlsWriteLabel(6,0,"NO"); xlsWriteLabel(6,1,"ID"); xlsWriteLabel(6,2,"Gender"); xlsWriteLabel(6,3,"Name"); xlsWriteLabel(6,4,"Lastname"); $xlsRow = 7; while(list($id,$prename,$name,$sname,$grade)=mysql_fetch_row($result)) { ++$i; xlsWriteNumber($xlsRow,0,"$i"); xlsWriteNumber($xlsRow,1,"$id"); xlsWriteLabel($xlsRow,2,"$prename"); xlsWriteLabel($xlsRow,3,"$name"); xlsWriteLabel($xlsRow,4,"$sname"); $xlsRow++; } xlsEOF(); exit(); |
source from www.appservnetwork.com
9 comments:
ไม่ทราบว่าจะตั้งชื่อ Function ในการ สร้างไฟล์ XLS ว่าอย่างไร ได้โปรด
ถ้าจะสร้างเป็นฟังก์ชั่น ก็ตั้งชื่อฟังก์ชั่นว่าอะไรก็ได้ครับ เพียงแค่ส่งค่าเข้ามามันก็จะใช้ได้แล้ว
แต่ในตัวอย่างเป็นการเรียกฟังก์ชั่น excel ด้านบนมาใช้เลยนะครับ แค่ก้อปมาไว้ให้อยู่ในหน้าเดียวกันเท่านั้นเอง
You might want to try this article from zedwood.com which has some sample code on how to generate a multi-worksheeted xls spreadsheet with formatting. It uses the PHP Pear package, but you can just download the code and run it. Its great.
Your code generates spreadsheets in excel 2.0 format. The zedwood code generates xls in excel 95 format which allows you to do all kinds of formatting etc.
情趣用品我情趣用品我情趣
視訊聊天室我辣妹視訊我視訊我美女視訊我視訊交友網我視訊聊天室我視訊交友我視訊美女我免費視訊我免費視訊聊天我視訊交友90739我免費視訊聊天室我成人聊天室
視訊聊天
A片下載我成人影片下載我免費A片下載我日本A片我情色A片我免費A片我成人影城我成人電影我線上A片我A片免費看
煙火我影音視訊聊天室我情趣用品我情趣用品我情趣我用品
I like the blog, thanks for giving the wonderful information.PHP Development
Thanks for sharing us.
pandora locations
zzzzz2018.8.24
louboutin shoes
new nike shoes
nike huarache femme
ralph lauren uk
hermes belts
louboutin outlet
coach outlet
vibram fivefingers
nike air max 95
supreme shirt
www1126
coach factory outlet
off white clothing
clarks shoes
ugg outlet
ecco shoes
kate spade
ed hardy uk
coach outlet online
true religion
c6v77i1e87 e7s53z2g74 h4c51l7h54 h1k24r3r50 q4w57n1d42 f5m59z1b38
Post a Comment