In the process of using phpexcel, you will inevitably encounter a variety of problems, especially in the import Excel table, we always can not get the desired Excel data from the editor, such as the following:
Obviously, I actually just want the text in this object, it's it ... Some of them can't stand it.
In fact, the solution to this method is very simple, the following is the entire code fragment
[PHP]
Require_once Site_path. ' /phpexcle/classes/phpexcel.php ';
Require_once Site_path. ' /phpexcle/classes/phpexcel/iofactory.php ';
Require_once Site_path. ' /phpexcle/classes/phpexcel/reader/excel5.php ';
$objReader = Phpexcel_iofactory::createreader (' Excel5 ');
$objPHPExcel = $objReader->load ($fileurl);
$sheet = $objPHPExcel->getsheet (0);
$highestRow = $sheet->gethighestrow ();
$highestColumn = $sheet->gethighestcolumn ();
for ($j = 2; $j <= $highestRow; $j + +) {
for ($k = ' A '; $k <= $highestColumn; $k + +) {
$array [$j] [$k] = (string) $objPHPExcel->getactivesheet ()->getcell ("$k $j")->getvalue ();
}
}
?>
That is, $objphpexcel->getactivesheet ()->getcell ("$k $j")->getvalue (), plus one (string) in front of it.
It's so simple!
Author Longxuu
http://www.bkjia.com/PHPjc/478282.html www.bkjia.com true http://www.bkjia.com/PHPjc/478282.html techarticle In the process of using phpexcel, you will inevitably encounter a variety of problems, especially in the import Excel table, we always can not get the desired Excel data from the editor, such as the following ...