Spreadsheet_Excel_Writer 這個PEAR LIB,可以將PHP的資料輸出成Excel檔案。
最近剛好需要將資料庫裡的資料讓使用者下載成excel檔案,剛好這個Spreadsheet_Excel_Writer正好可以使用,網路上已經有很多的相關文章了,這裡就記一下我使用後的筆記。
安裝
PEAR 如果PHP是自己編譯的話在configure加入 –with-pear 然後重新編譯它
# ./configure –with-pear
# make
# make install
Package Information: OLE
Easy Install:pear install OLE-1.0.0RC1
# /usr/local/php/bin/pear install OLE-1.0.0RC1
Package Information: Spreadsheet_Excel_Writer
Easy Install:pear install Spreadsheet_Excel_Writer-0.9.1
# /usr/local/php/bin/pear install Spreadsheet_Excel_Writer-0.9.1
* 注意: /usr/local/php 是我安裝php的路徑
修正
修正 Spreadsheet_Excel_Writer 的 unicode 問題
# patch Workbook.php < patch file
# patch Format.php < patch file
修正 Spreadsheet_Excel_Writer 檔案超過大小
使用
參考資料
http://blog.teatime.com.tw/1/post/301
http://blog.teatime.com.tw/1/post/111
http://www.ooso.net/archives/192
http://pear.php.net/package/Spreadsheet_Excel_Writer/docs
2 Responses to “php-excel-writer”
他有一個PEAR.php檔 我去下載卻沒發現這個檔案 這個檔案是? 我要自己寫嗎 還是
我有點搞不太懂啥pear的東西..
http://pear.php.net/package/PEAR/download 可以在這裡下載