2010
05.10
05.10
PHPExcel 读取execl里多个sheet里的内容 一个demo.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | < ?PHP
define("PHPEXCEL_ROOT","PHPExcel/"); //这里是定义PHPExcel的路径
require_once PHPEXCEL_ROOT.'PHPExcel.php';
require_once PHPEXCEL_ROOT.'IOFactory.php';
require_once PHPEXCEL_ROOT.'Reader/Excel2007.php';
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objReader->setReadDataOnly(true);
$objPHPExcel = $objReader->load("test.xlsx");
$sheetNum = $objPHPExcel->getSheetCount(); //获取sheet的个数
for($sheet=0;$sheet< $sheetNum;$sheet++) {
$objWorksheet = $objPHPExcel->getSheet($sheet);
$highestRow = $objWorksheet->getHighestRow();
$highestColumn = $objWorksheet->getHighestColumn();
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
echo '<table>' . "\n";
for ($row = 1; $row < = $highestRow; ++$row) {
echo '<tr>' . "\n";
for ($col = 0; $col < = $highestColumnIndex; ++$col) {
echo '<td>' . $objWorksheet->getCellByColumnAndRow($col, $row)->getValue() . '' . "\n";
}
echo '' . "\n";
}
echo '</table>' . "\n";
}
?> |
osedefyxapy…
Brendan Fletcher…
来过,踩过,不容错过!
o(∩_∩)o
来访……留个脚印,博主不要见怪,哈哈。
礼尚往来,哈哈,来过,希望博主有空回访小站。
精彩内容,怎容错过!
o(∩_∩)o
博主写的不错,学习了!
o(∩_∩)o
博主太有才了!!!
o(∩_∩)o
谢谢夸奖!嘻嘻。
顶!o(∩_∩)o
博主写的不错,学习中!o(∩_∩)o
欢迎回访!
o(∩_∩)o
Buy:Propecia.Maxaman.Viagra Super Force.Tramadol.Cialis Super Active+.Soma.Viagra Professional.VPXL.Levitra.Cialis.Zithromax.Viagra.Viagra Super Active+.Viagra Soft Tabs.Super Active ED Pack.Cialis Soft Tabs.Cialis Professional….
stein http://nsteinq45z.bestpartsstore.info/tag/target+Headboards+stein/ : stein…
stein…