KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Export to Excel appears to be broken in KoolReports 3.25.4 #830

Open Keith Burke opened this topic on on Apr 25, 2019 - 9 comments

Keith Burke commented on Apr 25, 2019

Hi,

Recently upgraded my KoolReports Pro from 2.43 to 3.25.4. Immediately Export to Excel fails to work. I get HTTP Error 500. If I swap back to KR Pro 2.43, it works again.

I don't appear to be getting any other errors and have [error_reporting(E_ALL); ini_set('display_errors', 1);]

It's this line that fails to run. $report->run()->exportToExcel(array( "dataStores" => array('query_result'),))->toBrowser("MonthToDate.xls");

<?php
require_once "MonthToDate.php";
$report = new MonthToDate();
$report->run()
->exportToExcel(array(
  "dataStores" => array(
    'query_result'
  ),
))
->toBrowser("MonthToDate.xls");
David Winterburn commented on Apr 25, 2019

Hi Keith,

Did you update the Excel package to a newer version as well? Thanks!

Keith Burke commented on Apr 25, 2019

I just unzipped KR Pro 3.25.4. My assumption was that the pro version downloaded through my accountincluded all the extra packages and new versions.

The 3.25.4 zip file does include /packages/excel/ExcelExportable.php

Keith Burke commented on Apr 25, 2019

Yeah, the CHANGELOG in /packages/excel shows version 5.0.0

David Winterburn commented on Apr 25, 2019

Hi Keith,

Would you please post the error message when exporting to excel as well as any message in the exported file if there is. Thanks!

Keith Burke commented on Apr 25, 2019
Fatal error: Uncaught Error: Call to undefined function PhpOffice\PhpSpreadsheet\Shared\mb_strlen() in /public_html/koolreport/packages/excel/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/StringHelper.php:475 Stack trace: #0 /public_html/koolreport/packages/excel/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Worksheet.php(462): PhpOffice\PhpSpreadsheet\Shared\StringHelper::countCharacters('Worksheet') #1 /public_html/koolreport/packages/excel/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Worksheet.php(848): PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::checkSheetTitle('Worksheet') #2 /public_html/koolreport/packages/excel/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Worksheet/Worksheet.php(344): PhpOffice\PhpSpreadsheet\Worksheet\Worksheet->setTitle('Worksheet', false) #3 /public_html/koolreport/packages/excel/ve in /public_html/koolreport/packages/excel/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Shared/StringHelper.php on line 475
Keith Burke commented on Apr 25, 2019

Running on a CentOS LAMP with PHP 7.1 No Excel file generated.

David Winterburn commented on Apr 26, 2019

Hi Keith,

It seems your previous version of KoolReport Pro used PHPExcel to generate excel files. Because PHPExcel hasn't been active since 2015 we have moved on to using PHPSpreadsheet in newer versions of KoolReport Pro.

PHPSpreadsheet makes use of mbstring (multibyte string) extension which is designed to handle Unicode-based encodings such as UTF-8. Since it's a non-default extension, it looks like your PHP hasn't enabled it. Here's a link for explaining the problem:

https://stackoverflow.com/questions/6419102/fatal-error-call-to-undefined-function-mb-strlen

Please try to enable mbstring and test excel export again. Let us know if you need any further information. Thanks!

Keith Burke commented on May 1, 2019

Grand. Installed MBString and that error is now gone but now another error. I've also installed the php-zip extension but the error remains. Is ZIP really required considering that it doesn't actually create a ZIP file?

I'm assuming php-zip is the correct extension to install...

Warning: Illegal offset type in isset or empty in /home/flyefit/kpistage.flyefit.ie/public_html/koolreport/packages/excel/ExcelExportable.php on line 103

Fatal error: Uncaught Error: Class 'ZipArchive' not found in /public_html/koolreport/packages/excel/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx.php:210 Stack trace: #0 /public_html/koolreport/packages/excel/ExcelExportable.php(225): PhpOffice\PhpSpreadsheet\Writer\Xlsx->save('/tmp/5cc962b760...') #1 /public_html/reports/roaming_member_activity/exportToExcel.php(10): RoamingMemberActivity->exportToExcel(Array) #2 {main} thrown in /public_html/koolreport/packages/excel/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx.php on line 210
Keith Burke commented on May 1, 2019

Nope, I take that back. I didn't restart... All sorted. Thanks.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
bug
help needed
solved

Excel