-
Notifications
You must be signed in to change notification settings - Fork 533
Description
When saving a file phppresentation that has an embedded excel document i am getting this exception
Type: PHPExcel_Writer_Exception
Message: Could not close zip file PHPExcel.xlsx.
Filename:
..path to /vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel2007.php
Line Number: 399
Backtrace:
File: ../vendor/phpoffice/phppresentation/src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php
Line: 256
Function: save
File: ../vendor/phpoffice/phppresentation/src/PhpPresentation/Writer/PowerPoint2007/PptCharts.php
Line: 39
Function: writeSpreadsheet
File:
../vendor/phpoffice/phppresentation/src/PhpPresentation/Writer/PowerPoint2007.php
Line: 128
Function: render
This is caused by the current directory the site is run from not having write permissions for apache.
the work around is
$cd = getcwd();
chdir(.path with write perms..);
$xmlWriter = PhpOffice\PhpPresentation\IOFactory::createWriter($oPHPPresentation, 'PowerPoint2007');
$xmlWriter->save($tmp_file);
chdir($cd);