KoolReport's Forum

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

Excel package missing function dataStore() in v8.0.1 #1855

Closed Advanced Applications GmbH opened this topic on on Jan 21, 2021 - 4 comments

Advanced Applications GmbH commented on Jan 21, 2021

I've recently upgraded to the newest Excel package (v8.0.1 at the time of writing) and now all my reports which are exported to Excel and call the $this->dataStore() method throw the following exception:

Fatal error: Uncaught Error: Call to undefined method koolreport\excel\ExportHandler::dataStore()

Where has this function gone? How can I access data stores in my Excel template?

Many of my templates rely on accessing data stores directly (outside any widgets).

David Winterburn commented on Jan 22, 2021

Please let us now the name of your excel view file and your export command. Thanks!

Advanced Applications GmbH commented on Jan 27, 2021

This is the piece of code that invokes the report run and it's export to Excel:

$reportClass = new MyReport();
$reportName = 'MyReport';
$reportClass->run()->exportToExcel($reportName)->toBrowser($reportName . '.xlsx');

And the file structure is as follows:

  • MyReport.php: Report class file
  • MyReport.view.php: HTML view file
  • MyReport.excel.php: Excel view file
David Winterburn commented on Jan 28, 2021

Please rename your excel view from MyReport.excel.php to MyReportExcel.view.php and use this export command:

$reportClass->run()->exportToExcel($reportName . "Excel")->toBrowser($reportName . '.xlsx');

The old excel view name doesn't work in some case. Let us know if the new name works. Thanks!

Advanced Applications GmbH commented on Jan 29, 2021

That fixed it, thank you!

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
help needed
solved

Excel