Using the Larvel 6.0 with the following code for exporting into Excel. the exported file is shown corrupted.
However, when we have checked same code in Laravel 7 and above versions, the file is getting exported and showing correctly.
We are using the following code
public function excel()
{
$report = new Report;
$report->run()->exportToExcel('excel')->toBrowser("myreport.xlsx");
}
<?php
namespace App\Reports;
use \koolreport\KoolReport;
class Report extends \koolreport\KoolReport
{
use \koolreport\laravel\Friendship;
use \koolreport\export\Exportable;
use \koolreport\excel\ExcelExportable;
function settings()
{
return array(
"dataSources"=>array(
"sample_data"=>array(
"class"=>'\koolreport\datasources\ArrayDataSource',
"dataFormat"=>"table",
"data"=>array(
array("name","age","income"),
array("John",26,50000),
array("Marry",29,60000),
array("Peter",34,100000),
array("Donald",28,80000),
)
)
)
);
}
function setup()
{
$node = $this->src('sample_data')->pipe($this->dataStore('unloadsPivot'));
}
}
Please Help.