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

然后調用
1. Call xlsBOF()
" /> 一区二区三区成人,在线观看欧美激情,综合激情国产一区

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

php生成EXCEL的東東

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

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

也可以用 fwrite 函數直接寫到服務器上,而不是用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技術php生成EXCEL的東東,轉載需保留來源!

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

主站蜘蛛池模板: 永寿县| 平罗县| 乳山市| 临沭县| 尤溪县| 黑山县| 枣阳市| 昌邑市| 霍州市| 铁力市| 吉木乃县| 兴国县| 银川市| 榆中县| 阳朔县| 云林县| 乌鲁木齐市| 平安县| 浦城县| 阿瓦提县| 盘山县| 营口市| 木里| 鸡泽县| 行唐县| 阿勒泰市| 双江| 武鸣县| 即墨市| 历史| 两当县| 平顺县| 乡宁县| 新宁县| 盐城市| 衡阳县| 津南区| 澳门| 江西省| 武威市| 淄博市|