I have a problem when trying to export file to Excel in PHP.
I tried with the PHPExcel
library even though it was deprecated / deprecated and tested with PhpSpreadSheet
as well. But both presented the same error and only in PHP 7.1.20 .
Error presented:
"excel can not open the file because the format or extension of file is not valid "
When opened with some text editor, it displays this message:
Fatal error : Uncaught PhpOffice \ PhpSpreadsheet \ Writer \ Exception: Could not open php: // output for writing. in C: \ DESENV \ DefaultCollection \ STCPWebAdmin \ Site \ www \ cgi-bin \ libs \ vendor \ phpoffice \ phpspreadsheet \ src \ PhpSpreadsheet \ Writer \ Xlsx.php: 218 Stack trace: < # 0 C: \ DESENV \ DefaultCollection \ STCPWebAdmin \ Site \ www \ stcpwebversionxls.php (104): PhpOffice \ PhpSpreadsheet \ Writer \ Xlsx-> save ('php: // output')
< # 1 {main} thrown in C: \ DESENV \ DefaultCollection \ STCPWebAdmin \ Site \ www \ cgi-bin \ libs \ vendor \ phpoffice \ phpspreadsheet \ src \ PhpSpreadsheet \ Writer \ Xlsx.php / b>
I tested in versions 7.1.14 and 7.1.17 and it worked normally .
Do you know why?