作者jj8221 (啾啾啾)
看板PHP
标题[请益] phpexcel问题
时间Mon Sep 17 09:46:10 2012
各位版上大大好
小弟再用phpexcel读取.xls档案时发生了错误
Fatal error: Uncaught exception 'Exception' with message 'ZipArchive library
is not enabled' in
C:\AppServ\www\phpexcel\Classes\PHPExcel\Reader\Excel2007.php:240 Stack
trace: #0 C:\AppServ\www\phpexcel\load.php(7):
PHPExcel_Reader_Excel2007->canRead('jxlrwtest.xls') #1 {main} thrown in
C:\AppServ\www\phpexcel\Classes\PHPExcel\Reader\Excel2007.php on line 240
我试过网路上许多方法
都不行
所以想请各位帮忙想想办法
以下是我的程式码
<?
require_once('../phpexcel/classes/PHPExcel.php');//加载PHPExcel
$fileName = 'jxlrwtest.xls';
$filePath = $fileName;
$PHPExcel = new PHPExcel();
$PHPReader = new PHPExcel_Reader_Excel2007();
if(!$PHPReader->canRead($filePath)){
$PHPReader = new PHPExcel_Reader_Excel5();
if(!$PHPReader->canRead($filePath)){
echo 'no Excel';
return ;
}
}
$PHPExcel = $PHPReader->load($filePath);
//$currentSheet = $PHPExcel->getSheet(0);
/**取得一共有多少列*/
$allColumn = $currentSheet->getHighestColumn();
/**取得一共有多少行*/
$allRow = array($currentSheet->getHighestRow());
for($currentRow = 1;$currentRow<=$allRow;$currentRow++){
for($currentColumn='A';$currentColumn<=$allColumn;$currentColumn++){
$address = $currentColumn.$currentRow;
echo $currentSheet->getCell($address)->getValue()."\t";
}
echo "\n";
}
?>
谢谢各位
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.131.39.60