I have the LaravelExcelWriter object, how can I display it in browser as html? I have a piece of code like this:
public function generateExel()
{
$obj = Excel::create(...
...
return $obj;
}
public function showExcel()
{
$obj = $this->generateExcel();
// and now I want to show it in browser
}
If I do just return $obj
or echo $obj
, I get
Object of class Maatwebsite\Excel\Writers\LaravelExcelWriter could not be converted to string
If I json_encode()
it, I get string with some technical data about object, but without the sheet itself.
I've also tried to do as it was written here, but got an error that method all()
is not found.
Maybe I should somehow convert it to PHPExcel, save temporary file and then open it in browser, something like here? Or maybe it is possible to reverse this process? Or is there any easier ways?
via Yawning Milk