Am using Laravel Excel version 3.1 to generate CSV/XLS etc. I have to customized my csv or xls to have a custom footer and header spanned through the columns.
Its should look like in the screenshot attached.
Also, I want to store the exported file to storage location but cant make iy work.
And the code I have done is:
class ReportExport implements FromArray, WithHeadings
{
protected $results;
public function __construct(array $results, array $headings, array $fileAttributes)
{
$this->results = $results;
$this->headings = $headings;
$this->file_attributes = $fileAttributes;
}
/**
* @return array
*/
public function array(): array
{
return $this->results;
}
/**
* @return array
*/
public function headings(): array
{
return $this->headings;
}
public function registerEvents(): array
{
return [
// Handle by a closure.
BeforeExport::class => function(BeforeExport $event) {
$event->writer->getProperties()->setTitle('Patrick');
},
];
}
}
Calling i as below:
Excel::store(["1","2"],"xyz.xlsx");
How can I add these extra lines to my exported results.
