KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.

Unreadable content in Excel export #972

Open Toby Beresford opened this topic on on Jul 4 - 5 comments

Toby Beresford commented on Jul 4

Heya I've just purchased the koolreport/excel package for a project. Whenever I export to Excel Excel opens with an error message - unreadable content? "We found a problem with some content in 'recruitment-report-2019-07-04 (4).xlsx'. Do you want us to try to recover as much as we can? If you trust the source of this workbook, click Yes."

Have you seen this issue before, do you know what might causing this? I can see this irritating the customer if they have to click through these popups every day.

Thanks Toby

David Winterburn commented on Jul 5

Hi Toby,

Please send us one of the excel file with problem to our email support@koolphp.net. Thanks!

Toby Beresford commented on Jul 5

Thanks David. Sent. Hope you can sleuth out the issue!

David Winterburn commented on Jul 5

Thanks, Toby! I've looked into your excel file and it seems after the excel content there're html content at the end of the file which corrupts it as an excel file:

//yourFile.xlsx
{excel content}
<link rel='stylesheet' type='text/css' property='stylesheet' href='//rwc.localhost/_debugbar/assets/stylesheets?v=1553506748'><script type='text/javascript' src='//rwc.localhost/_debugbar/assets/javascript?v=1553506748'></script><script type="text/javascript">jQuery.noConflict(true);</script>
...

This indicates that after your export command, there're still more outputs in your page. Please make sure that your php stop executing or outputing any html content after the export command. One fast and hacky solution is to put the exit command after export:

...
->toBrowser("yourFile.xlsx");
exit;

But I don't recommend using this as a long term solution. It's better if you could clean your code structure to better understand its output flow. Thanks!

Toby Beresford commented on Jul 5

Great thanks David! It's the laravel debugger that's getting in the way. I will sort out.

paulo commented on Aug 29

Hi Toby, how did you sort this out? I might have the same issue. do you mind sharing ? Thanks

KoolReport Is Free and Open-Source!

KoolReport is a professional php reporting framework which saves you tons of time to construct dynamic data report & dashboard.

  • Connect to various datasources such as MySQL, SQL Server, MongoDB or even from CSV or Excel file.
  • Contain series of powerful built-in data processes for your data manipulation.
  • Generate stunning charts and graphs to help you communicate data insights to your audiences effectively.
  • Integrate seamlessly with any php frameworks such as Laravel, CodeIgniter, Symfony.
Download Now and register our tutorials to get started!

Download KoolReport
help needed

Excel