You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
Im sharing my solution to make excel export to work, as i was getting a white screen. For fixing this im using phpspreadsheet, phpexcel is abandoned.
cd folderofphpreportscript
composer require phpoffice/phpspreadsheet
cd classes/report_formats/
-----Where the old files for excel exist
/var/www/html/ticket/phpreport/vendor/phpoffice/phpspreadsheet/bin/migrate-from-phpexcel
-----Run the script to change old phpexcel commands to phpspreadsheet's commands
If succesfull, you will get the following lines :
Make sure that XlsxReportFormat.php in classes/report_formats/ is like :
<?php
use PhpOffice\PhpSpreadsheet\Helper\Sample;
use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
class XlsxReportFormat extends XlsReportBase {
public static function display(&$report, &$request) {
// First let set up some headers
$spreadsheet = new Spreadsheet();
$file_name = preg_replace(array('/[\s]+/','/[^0-9a-zA-Z\-_\.]/'),array('_',''),$report->options['Name']);
//always use cache for Excel reports
$report->use_cache = true;
//run the report
$report->run();
if(!$report->options['DataSets']) return;
$objPHPExcel = parent::getExcelRepresantation($report);
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="'.$file_name.'.xlsx"');
header('Pragma: public');
header('Expires: 0');
$objWriter = IOFactory::createWriter($objPHPExcel, 'Xlsx');
$objWriter->save('php://output');
}
}
The text was updated successfully, but these errors were encountered:
schtritoff
added a commit
to schtritoff/php-reports
that referenced
this issue
Sep 16, 2021
Hi,
Im sharing my solution to make excel export to work, as i was getting a white screen. For fixing this im using phpspreadsheet, phpexcel is abandoned.
-----Where the old files for excel exist
-----Run the script to change old phpexcel commands to phpspreadsheet's commands
If succesfull, you will get the following lines :
The text was updated successfully, but these errors were encountered: