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 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
include('../PHPExcel/Classes/PHPExcel.php');
// création des objets de base et initialisation des informations d'entête
$classeur = new PHPExcel;
$classeur->getProperties()->setCreator("XXXXX");
$classeur->setActiveSheetIndex(0);
$feuille=$classeur->getActiveSheet();
// ajout des données dans la feuille de calcul
$feuille->setTitle('Nom affiché dans l\'onglet');
$feuille->setCellValueByColumnAndRow(0, 1, 'NOM_ELEVE');
$feuille->setCellValueByColumnAndRow(1, 1, 'PRENOM_ELEVE');
$feuille->setCellValueByColumnAndRow(2, 1, 'SEXE');
$feuille->setCellValueByColumnAndRow(3, 1, 'DATE_NAISSANCE');
$feuille->setCellValueByColumnAndRow(4, 1, 'LIEU_NAISSANCE');
$feuille->setCellValueByColumnAndRow(5, 1, 'NATIONALITE');
$feuille->setCellValueByColumnAndRow(6, 1, 'MAIL_ELEVE');
$feuille->setCellValueByColumnAndRow(7, 1, 'PORTABLE_ELEVE');
$feuille->setCellValueByColumnAndRow(8, 1, 'PASSAGE');
$feuille->setCellValueByColumnAndRow(9, 1, 'LVA');
$feuille->setCellValueByColumnAndRow(10, 1, 'LVB');
$feuille->setCellValueByColumnAndRow(11, 1, 'EURO');
$feuille->setCellValueByColumnAndRow(12, 1, 'DNL');
$feuille->setCellValueByColumnAndRow(13, 1, 'OPTION_1');
$feuille->setCellValueByColumnAndRow(14, 1, 'OPTION_2');
$feuille->setCellValueByColumnAndRow(15, 1, 'SPECIALITE_1');
$feuille->setCellValueByColumnAndRow(16, 1, 'SPECIALITE_2');
$feuille->setCellValueByColumnAndRow(17, 1, 'SPECIALITE_3');
$feuille->setCellValueByColumnAndRow(18, 1, 'R1_CIVILITE');
$feuille->setCellValueByColumnAndRow(19, 1, 'R1_NOM');
$feuille->setCellValueByColumnAndRow(20, 1, 'R1_PRENOM');
$feuille->setCellValueByColumnAndRow(21, 1, 'R1_MAIL');
$feuille->setCellValueByColumnAndRow(22, 1, 'R1_DOMICILE');
$feuille->setCellValueByColumnAndRow(23, 1, 'R1_PORTABLE');
$feuille->setCellValueByColumnAndRow(24, 1, 'R1_BUREAU');
$feuille->setCellValueByColumnAndRow(25, 1, 'R1_ADRESSE');
$feuille->setCellValueByColumnAndRow(26, 1, 'ELEVE_RESIDE');
$feuille->setCellValueByColumnAndRow(27, 1, 'R1_LIEN');
$feuille->setCellValueByColumnAndRow(28, 1, 'R2_CIVILITE');
$feuille->setCellValueByColumnAndRow(29, 1, 'R2_NOM');
$feuille->setCellValueByColumnAndRow(30, 1, 'R2_PRENOM');
$feuille->setCellValueByColumnAndRow(31, 1, 'R2_MAIL');
$feuille->setCellValueByColumnAndRow(32, 1, 'R2_DOMICILE');
$feuille->setCellValueByColumnAndRow(33, 1, 'R2_PORTABLE');
$feuille->setCellValueByColumnAndRow(34, 1, 'R2_BUREAU');
$feuille->setCellValueByColumnAndRow(35, 1, 'R2_ADRESSE');
$feuille->setCellValueByColumnAndRow(36, 1, 'ELEVE_RESIDE');
$feuille->setCellValueByColumnAndRow(37, 1, 'R2_LIEN');
// envoi du fichier au navigateur
$writer = PHPExcel_IOFactory::createWriter($classeur, 'Excel2007');
header('Content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="recap-'.date('Y-m-d').'.xlsx"');
header('Cache-Control: max-age=0');
$writer->save('php://output'); |
Partager