$dataCell)
{
foreach($dataCell as $key => $cell)
{
$assoc[$key] = array($sheet, $cell);
}
}
//Ecriture dans modèles
require_once 'lib/phpexcel/PHPExcel.php';
$objPHPexcel = PHPExcel_IOFactory::load(realpath(dirname(__FILE__)).'/'.$xlsFile);
foreach( $assoc as $key => $position )
{
$sheet = $position[0];
$cell = $position[1];
if (array_key_exists($key, $values))
{
$objWorksheet = $objPHPexcel->getSheet($sheet);
$objWorksheet->getCell($cell)->setValue($values[$key]);
}
/*
else
{
$objWorksheet = $objPHPexcel->getSheet($sheet);
$objWorksheet->getCell($cell)->setValue('_');
//echo "La clé $key n'a pas de valeur!
";
}
*/
}
$objPHPexcel->setActiveSheetIndex(0);
$objWriter = PHPExcel_IOFactory::createWriter($objPHPexcel, $writerType);
$objWriter->save($xlsWriteFile);
}
if( file_exists($xlsWriteFile) )
{
$client->setLog('liassexls', $siren, 0, '');
echo 'Télécharger le fichier excel.';
}
else
{
echo "Erreur lors de la construction du fichier.";
}
?>