----------------------------
Excel Functions
----------------------------
將下面的代碼存為excel.php ,然后在頁面中包括進(jìn)來

然后調(diào)用
1. Call xlsBOF()
" /> 久久狠狠一本精品综合网,激情视频亚洲,日韩专区av

色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

php生成EXCEL的東東

可以通過php來產(chǎn)生EXCEL檔.  teaman翻譯
----------------------------
Excel Functions
----------------------------
將下面的代碼存為excel.php ,然后在頁面中包括進(jìn)來

然后調(diào)用
1. Call xlsBOF()  
2. 將一些內(nèi)容寫入到xlswritenunber() 或者 xlswritelabel()中.
3.然后調(diào)用 Call xlsEOF()

也可以用 fwrite 函數(shù)直接寫到服務(wù)器上,而不是用echo 僅僅在瀏覽器上顯示。



<?php
// ----- begin of function library -----
// Excel begin of file header
function xlsBOF() {
    echo pack("ssssss", 0x809, 0x8, 0x0, 0x10, 0x0, 0x0);  
    return;
}
// Excel end of file footer
function xlsEOF() {
    echo pack("ss", 0x0A, 0x00);
    return;
}
// Function to write a Number (double) into Row, Col
function xlsWriteNumber($Row, $Col, $Value) {
    echo pack("sssss", 0x203, 14, $Row, $Col, 0x0);
    echo pack("d", $Value);
    return;
}
// Function to write a label (text) into Row, Col
function xlsWriteLabel($Row, $Col, $Value ) {
    $L = strlen($Value);
    echo pack("ssssss", 0x204, 8 + $L, $Row, $Col, 0x0, $L);
    echo $Value;
return;
}
// ----- end of function library -----
?>

//  
// To display the contents directly in a MIME compatible browser  
// add the following lines on TOP of your php file:

<?php
header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header ("Last-Modified: " . gmdate("D,d M YH:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate");     
header ("Pragma: no-cache");     
header ('Content-type: application/x-msexcel');
header ("Content-Disposition: attachment; filename=EmplList.xls" );  
header ("Content-Description: php/INTERBASE Generated Data" );
//
// the next lines demonstrate the generation of the Excel stream
//
xlsBOF();   // begin Excel stream
xlsWriteLabel(0,0,"This is a label");  // write a label in A1, use for dates too
xlsWriteNumber(0,1,9999);  // write a number B1
xlsEOF(); // close the stream
?>

php技術(shù)php生成EXCEL的東東,轉(zhuǎn)載需保留來源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請第一時間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 大石桥市| 嘉鱼县| 佛教| 大荔县| 施甸县| 宜兰市| 枣阳市| 泾源县| 安远县| 南华县| 墨玉县| 旬阳县| 周口市| 竹溪县| 雅安市| 中卫市| 儋州市| 林口县| 乐东| 儋州市| 阿拉善盟| 石泉县| 花垣县| 峨山| 兰考县| 类乌齐县| 绥中县| 巨野县| 墨江| 新营市| 甘孜县| 元氏县| 龙井市| 明星| 临沧市| 雅江县| 杭州市| 镇沅| 米脂县| 固始县| 英吉沙县|