New file |
0,0 → 1,64 |
<?php |
require_once dirname(__FILE__).DS.'excel_reader'.DS.'excel_reader2.php'; |
|
class LecteurExcel { |
|
private $lecteur = null; |
private $fichier = ''; |
private $feuille = 0; |
|
public function __construct($fichierExcel) { |
error_reporting(E_ALL ^ E_NOTICE); |
$this->fichier = $fichierExcel; |
$this->lecteur = new Spreadsheet_Excel_Reader(); |
$this->lecteur->setUTFEncoder('mb'); |
$this->lecteur->setOutputEncoding('UTF-8'); |
$this->lecteur->read($this->fichier); |
} |
|
public function getFichier() { |
return $this->fichier; |
} |
|
public function getFeuille() { |
return $this->feuille; |
} |
|
public function setFeuille($feuille) { |
return $this->feuille = $feuille; |
} |
|
public function getValeur($ligne, $colonne) { |
$val = $this->lecteur->val($ligne, $colonne, $this->feuille); |
return $val; |
} |
|
public function getValeurBrute($ligne, $colonne) { |
return $this->lecteur->raw($ligne, $colonne, $this->feuille); |
} |
|
public function getNbreLignes() { |
return $this->lecteur->rowcount($this->feuille); |
} |
|
public function getNbreColonne() { |
return $this->lecteur->colcount($this->feuille); |
} |
|
public function getDonnees() { |
return $this->lecteur->sheets[$this->feuille]; |
} |
|
public function afficherTxt() { |
foreach ($this->lecteur->sheets as $k => $data) { |
echo "Fichier : {$this->fichier}.\nFeuille $k\n"; |
foreach ($data['cells'] as $idRow => $row) { |
foreach ($row as $idCol => $cell) { |
echo $this->getValeur($idRow, $idCol)."\t"; |
} |
echo "\n"; |
} |
} |
} |
} |
?> |