par
BaygonVert » 13 juin 2012, 13:31
Bonjour a tous !
Je me remets au php (arret de tout codage depuis plusieurs années) et je me retrouve donc certainement avec des problemes 'tous betes'...
J essaie dans un premier temps d utiliser la bib PHPExcel pour recopier un tableau Excel au format HTML, voici mon code :
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Transfert Excel > Table</title>
</head>
<body>
<?php
/** Include path **/
set_include_path(get_include_path() . PATH_SEPARATOR . 'Classes/');
/** PHPExcel_IOFactory */
require_once 'PHPExcel/IOFactory.php';
$inputFileName = "details.xls";
$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
$objWorksheet = $objPHPExcel->getSheet(0);
echo '<table border="1">';
foreach($sheet->getRowIterator() as $row)
echo '<tr>';
foreach($row->getCellIterator() as $cell)
{
echo'<td>';
print_r($cell->getValue());
echo'</td>';
}
echo '<\tr>';
echo '</table>'
?>
</body>
Et voici le debut du code de "IOFactory.php" :
/** PHPExcel root directory */
//echo 'tructruc';
if (!defined('PHPEXCEL_ROOT')) {
/**
* @ignore
*/
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../');
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
}
/**
* PHPExcel_IOFactory
*
* @category PHPExcel
* @package PHPExcel
* @copyright Copyright (c) 2006 - 2012 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_IOFactory
{
/**
* Search locations
*
* @var array
* @access private
* @static
*/
...
}
Lors de l'execution de mon code, j ai une erreur fatale :
Fatal error: Class '�PHPExcel_IOFactory' not found in C:\Program Files (x86)\EasyPHP-5.3.9\www\ExcelToTable.php on line 20
pourtant le fichier IOFactory.php est bien inclus (testé via mon " echo 'tructruc' a la deuxieme ligne de IOFactory.php)
Voila voila, si vous avez une idée je suis preneur.