30 if (!defined(
'PHPEXCEL_ROOT')) {
34 define(
'PHPEXCEL_ROOT', dirname(__FILE__) .
'/../../');
38 require_once PHPEXCEL_ROOT .
'PHPExcel.php';
41 require_once PHPEXCEL_ROOT .
'PHPExcel/Reader/IReader.php';
44 require_once PHPEXCEL_ROOT .
'PHPExcel/Shared/File.php';
65 if (!file_exists($pFilename)) {
66 throw new Exception(
"Could not open " . $pFilename .
" for reading! File does not exist.");
79 public function load($pFilename)
82 if (!file_exists($pFilename)) {
83 throw new Exception(
"Could not open " . $pFilename .
" for reading! File does not exist.");
88 throw new Exception(
"Invalid file format for PHPExcel_Reader_Serialized: " . $pFilename .
".");
101 $xmlData = simplexml_load_string(file_get_contents(
"zip://$pFilename#phpexcel.xml"));
102 $excel = unserialize(base64_decode((
string)$xmlData->data));
105 for ($i = 0; $i < $excel->getSheetCount(); ++$i) {
106 for ($j = 0; $j < $excel->getSheet($i)->getDrawingCollection()->count(); ++$j) {
107 if ($excel->getSheet($i)->getDrawingCollection()->offsetGet($j) instanceof PHPExcl_Worksheet_BaseDrawing) {
108 $imgTemp =& $excel->getSheet($i)->getDrawingCollection()->offsetGet($j);
109 $imgTemp->setPath(
'zip://' . $pFilename .
'#media/' . $imgTemp->getFilename(),
false);
126 if (!file_exists($pFilename)) {
127 throw new Exception(
"Could not open " . $pFilename .
" for reading! File does not exist.");