Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
Pls try with a simple excel view file with one sheet div and one table like this:
//MyReportExcel.view.php
<div sheet-name="sheet1">
<div>
<?php
$ds = $this->getDatastore(...); // fill in one datastore name with data here
Table::creat(array(
"name" => "table1",
"dataSource" => $ds,
)); // test it with no "columns" property
?>
</div>
</div>
Let us know the result. Send us the exported excel file to support@koolphp.net or support@koolreport.com if it's still corrupted. Tks,
Hi, thanks for sending the corrupted excel file. After checking the content of the file we found that there are a couple of curly brace characters at the end of the file ("{}"), which corrupted it. It looks like the output of the excel file was followed by some other output. To prevent such case pls don't include the end of php script sign ?> at the end of your export php file, as well as try to add ob_start() like this:
<?php
//Export.php
ob_start(); //Turn on output buffering so that any warning/notice message wouldn't be output
$report = new MyReport();
$report->run();
ob_end_clean(); // clear buffering without outputting it
// output excel file content
$report
->exportToExcel('MyReportExcel')
->toBrowser("MyReport.xlsx");
// it's a good practice to not include ?> at the end of php file because any blank space or special character after ?> would be output as well. In this case it would have corrupted the excel file content
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo