I am facing issue with export to excel. I am using codeigniter 4 GroceryCRUD 2.9.2, However export to pdf and print works as expected. The error details.
We’ve tracked this issue that the export to excel doesn’t work for PHP 8. Can you please confirm that the version of PHP is version 8 or later? I will try to fix this issue for the next release.
I am glad to inform you that the latest version of Grocery CRUD Enterprise (2.9.3) now includes the fix for the export to excel. In order to download the latest version visit the page: User's Page Login
I’ve just downloaded the latest version (grocery-crud-enterprise-with-codeigniter-4-v2.9.3.zip), and still have the same issue of the previous version regarding export to Excel: ERR_INVALID_RESPONSE
Basically,
This works: https://my_site/public/index.php/main/referencias?action=export-pdf&page=1&per_page=10&order_by=referencia&sorting=asc
This doesn’t work: http://my_site/public/index.php/main/referencias?action=export&page=1&per_page=10&order_by=referencia&sorting=asc
I couldn’t reproduce the issue but after updating PHP to version 8.1 the issue is now reproducible. Can you please confirm that the PHP version that you use is 8.1?
I’ve fixed some issues with PHP 8.1 for 2.9.3 but I am still investigating on this one.
some of my grids are exporting in php 8.1 some of them not. I guess is because the grids that are not exported contains a date field.
here are my findings:
grep -r --include=“*.php” strftime .
./scoumbourdis/phpexcel/Classes/PHPExcel/Calculation/DateTime.php: $testVal3 = strftime(‘%Y’);
./scoumbourdis/phpexcel/Classes/PHPExcel/Calculation/DateTime.php: $PHPDateArray[‘year’] = strftime(‘%Y’);
./scoumbourdis/phpexcel/Classes/PHPExcel/Calculation/DateTime.php: $PHPDateArray[‘month’] = strftime(‘%m’);
./scoumbourdis/phpexcel/Classes/PHPExcel/Calculation/DateTime.php: $PHPDateArray[‘day’] = strftime(‘%d’);
I solved by adding the error_reporting line in ./grocerycrud/enterprise/src/GroceryCrud/Core/State/ExportState.php,
but I don’t know for why just worked …
public function exportToExcel($data, $columns)
{
error_reporting(E_ERROR | E_WARNING | E_PARSE);
Now from your findings we may also have the same issues with dateTime? I will investigate and let you know.
Thanks for the update @GabrielD by the way, it really helped As PHPExcel is deprecated I am trying to do all the updates myself and it is hard to keep track of every new deprecation from PHP 8 (or even in some cases PHP 7)