Buenas chicos tengo un problema con PHPExcel, lo que quiero es dar formato de fecha al valor que recupero del archivo xlsx. Me sale este error
Warning: call_user_func() expects parameter 1 to be a valid callback, class 'PHPExcel_CachedObjectStorage_Memory' not found in C:\xampp\htdocs\Paginas prueba\PHPExcel\Classes\PHPExcel\CachedObjectStorageFactory.php on line 177
Warning: call_user_func() expects parameter 1 to be a valid callback, class 'PHPExcel_CachedObjectStorage_Memory' not found in C:\xampp\htdocs\Paginas prueba\PHPExcel\Classes\PHPExcel\CachedObjectStorageFactory.php on line 177
Fatal error: Uncaught Error: Call to a member function isDataSet() on bool in C:\xampp\htdocs\Paginas prueba\PHPExcel\Classes\PHPExcel\Worksheet.php:1148 Stack trace: #0 C:\xampp\htdocs\Paginas prueba\PHPExcel\Classes\PHPExcel\Reader\Excel2007.php(908): PHPExcel_Worksheet->getCell('A1') #1 C:\xampp\htdocs\Paginas prueba\PHPExcel\Classes\PHPExcel\IOFactory.php(192): PHPExcel_Reader_Excel2007->load('visitas.xlsx') #2 C:\xampp\htdocs\Paginas prueba\PHPExcel\leer.php(16): PHPExcel_IOFactory::load('visitas.xlsx') #3 {main} thrown in C:\xampp\htdocs\Paginas prueba\PHPExcel\Classes\PHPExcel\Worksheet.php on line 1148
Este es mi codigo:
<?php
include 'Classes/PHPExcel/IOFactory.php';
include 'Classes/PHPExcel/Cell.php';
include 'Classes/PHPExcel/Cell/DataType.php';
include 'Classes/PHPExcel/Worksheet.php';
include 'Classes/PHPExcel/Reader/Excel2007.php';
include 'Classes/PHPExcel/Style/NumberFormat.php';
include 'Classes/PHPExcel.php';
$file = 'visitas.xlsx';
$objPHPExcel = PHPExcel_IOFactory::load($file);
$hojaExcel = $objPHPExcel->setActiveSheetIndex(0);
$numRows = $hojaExcel->getHighestRow();
$maxCol = $hojaExcel->getHighestColumn();
$numColums = PHPExcel_Cell::columnIndexFromString($maxCol);
echo '<table border=1>';
echo "<tr>";
for ($i=0; $i < $numColums; $i++) {
$header = $hojaExcel->getCellByColumnAndRow($i, 1)->getValue();
if ($i > 0) {
$hojaExcel->getStyle('B1:'.$maxCol.'1')
->getNumberFormat()
->setFormatCode('yyyy-mmm-dd');
$letra = PHPExcel_Cell::stringFromColumnIndex($i);
$header = $hojaExcel->getCell($letra.'1')->getFormattedValue();
}
echo '<td>'.$header.'</td>';
}
echo "</tr>";
for ($i=2; $i <= $numRows; $i++) {
echo "<tr>";
for ($j=0; $j < $numColums; $j++) {
$header = $hojaExcel->getCellByColumnAndRow($j, $i)->getValue();
echo '<td>'.$header.'</td>';
}
echo "</tr>";
}
echo '</table>';
?>