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 34
|
include 'PHPExcel.php';
include 'PHPExcel/Writer/Excel2007.php';
// Connexion à la base et requête SQL
...
$objet = new PHPExcel_Reader_Excel2007();
$excel = $objet->load('reporting.xlsx');
$sheet = $excel->getSheet(1);
$ligne=2;
while($data = mysql_fetch_assoc($req)) {
$sheet->setCellValue('D'.$ligne, "=JOURSEM(Y2)"); //cette ligne ne marche pas
$sheet->setCellValue('A'.$ligne, "=SI(1=1;1;0)"); //cette ligne ne marche pas
$sheet->setCellValue('A'.$ligne, "=IF(1=1,1,0)"); //cette ligne marche
$sheet->setCellValue('A'.$ligne, "=SI(ET(AL2='D';Z2>='08:00:00';Z2<'18:00:00');1;0)"); // cette ligne ne marche pas
$sheet->setCellValue('A'.$ligne, "=IF(ET(AL2='D',Z2>='08:00:00',Z2<'18:00:00'),1,0)"); // cette ligne ne marche pas non plus
$sheet->setCellValue('A'.$ligne, '=IF(ET(AL2="D",Z2>="08:00:00",Z2<"18:00:00"),1,0)'); // devinez !? :(
$sheet->setCellValue('Y'.$ligne, $data['c1']); // Cette ligne marche
$ligne++;
}
$writer = new PHPExcel_Writer_Excel2007($excel);
//sortie sur le navigateur
header('Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition:inline;filename=reporting.xlsx');
$writer->save('php://output'); |
Partager