2009-07-31 8 views

Répondre

1

Si j'inderstand correctement, vous devez générer un fichier Excel à partir de PHP?

Si oui, jetez un oeil à un composant PEAR appelé Spreadsheet_Excel_Writer

Dans le introduction of the manual, il y a un exemple qui ressemble un peu ce que vous essayez d'atteindre:

<?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(); 
?> 

Il pourrait vous aider à faire ce que vous voulez :-)


Si je ne comprenais pas et vous avez seulement besoin de lire un ex fichier ... Eh bien cel:

  • pour le télécharger, vous pouvez utiliser curl ou fopen et autres
  • de le lire, PHP-ExcelReader pourrait faire l'affaire
Questions connexes