最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

php生成EXCEL的東東

 更新時間:2006年10月09日 00:00:00   作者:  
可以通過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
?>

相關(guān)文章

最新評論

神池县| 巢湖市| 梁平县| 尉氏县| 浠水县| 上饶县| 东兰县| 巴楚县| 江达县| 子长县| 微山县| 务川| 福安市| 清徐县| 布尔津县| 昌宁县| 临泽县| 翼城县| 滦平县| 嘉定区| 多伦县| 湄潭县| 凤翔县| 广河县| 尼玛县| 株洲县| 麻栗坡县| 菏泽市| 台江县| 五大连池市| 通河县| 石城县| 岑溪市| 曲松县| 开阳县| 兴仁县| 富裕县| 崇阳县| 虞城县| 阿巴嘎旗| 咸阳市|