Nasıl PHPExcel ile xlsx dosyası Ön iki okunur?

0 Cevap php

Ben birinci levha ile benim xlsx elektronik tablo ve döngü okumak için biliyorum.

Bu 5 yaprak vardır ve ben ilk daha herhangi başka alma konusunda sorun yaşıyorum.

Here is the code I am using which was straight from the documentation. You can see I tried to utilize setActiveSheet, but that threw the error Call to undefined method PHPExcel::setActiveSheet().

Code:

$objReader = PHPExcel_IOFactory::createReader('Excel2007');
$objReader->setReadDataOnly(true);
$objPHPExcel = $objReader->load("cmt_school_data.xlsx");
//$objPHPExcel->setActiveSheet(1);
$objWorksheet = $objPHPExcel->getActiveSheet();

echo '<table border=1>' . "\n";

foreach ($objWorksheet->getRowIterator() as $row) {

  echo '<tr>' . "\n";

  $cellIterator = $row->getCellIterator();

  // This loops all cells, even if it is not set.
  // By default, only cells that are set will be iterated.
  $cellIterator->setIterateOnlyExistingCells(false);

  foreach ($cellIterator as $cell) {
    echo '<td>' . $cell->getValue() . '</td>' . "\n";
  }

  echo '</tr>' . "\n";

}

echo '</table>' . "\n";

0 Cevap