1 pièce(s) jointe(s)
[PEAR] Utilisation de Spreadsheet_Excel_writer avec un include
Bonjour à tous
Je veux commencer à utiliser Spreadsheet_Excel_writer.
J'ai simplement récupérer un exemple de la doc, et ajouter mon propre code
Hors le fait d'ajouter le include('../config.php') me génère un fichier exel erroné (voir pièce jointe).
Si j'enlève la ligne include, le fichier généré est bon
Code:
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
|
include('../config.php');
require_once 'Spreadsheet/Excel/Writer.php';
// Creating a workbook
$workbook = new Spreadsheet_Excel_Writer();
// sending HTTP headers
$workbook->send('test.xls');
// Creating a worksheet
$worksheet =& $workbook->addWorksheet('My first worksheet');
// The actual data
$worksheet->write(0, 0, 'Name');
$worksheet->write(0, 1, 'Age');
$worksheet->write(1, 0, 'John Smith');
$worksheet->write(1, 1, 30);
$worksheet->write(2, 0, 'Johann Schmidt');
$worksheet->write(2, 1, 31);
$worksheet->write(3, 0, 'Juan Herrera');
$worksheet->write(3, 1, 32);
// Let's send the file
$workbook->close(); |
Pour info, j'ai commenté toute les lignes de mon fichier config.php
Je ne vois pas pourquoi l'include gêne la génération du fichier