<?php
/**
*
* @copyright 2007-2012 xiaoqiang.
* @author xiaoqiang.wu
* @version 1.01
*/
error_reporting(e_all);
date_default_timezone_set('asia/shanghai');
/** phpexcel_iofactory */
require_once '../classes/phpexcel/iofactory.php';
// check prerequisites
if (!
file_exists("31excel5.xls")) {
exit("not found 31excel5.xls.n");
}
$reader = phpexcel_iofactory::createreader('excel5'); //设置以excel5格式(excel97-2003工作簿)
$phpexcel = $reader->load("31excel5.xls"); // 载入excel文件
$sheet = $phpexcel->getsheet(0); // 读取第一個工作表
$highestrow = $sheet->gethighestrow(); // 取得总行数
$highestcolumm = $sheet->gethighestcolumn(); // 取得总列数
$highestcolumm= phpexcel_cell::columnindexfromstring($colsnum); //字母列转换为数字列 如:aa变为27
/** 循环读取每个单元格的数据 */
for ($row = 1; $row <= $highestrow; $row++){//行数是以第1行开始
for ($column = 0; $column < $highestcolumm; $column++) {//列数是以第0列开始
$columnname = phpexcel_cell::stringfromcolumnindex($column);
echo $columnname.$row.":".$sheet->getcellbycolumnandrow($column, $row)->getvalue()."<br />";
}
}
?>