Laravel maatwebsite excel并排显示多个表格
我有从Maatwebsite创建电子表格的代码,我使用Laravel 5.7 我的代码描述如下:Laravel maatwebsite excel并排显示多个表格,laravel,phpspreadsheet,maatwebsite-excel,Laravel,Phpspreadsheet,Maatwebsite Excel,我有从Maatwebsite创建电子表格的代码,我使用Laravel 5.7 我的代码描述如下: export.blade.php <table> <thead> <tr><th colspan="{{ $colspan }}">{{ $monthText }}</th></tr> <tr> @foreach($theader as $thead)
export.blade.php
<table>
<thead>
<tr><th colspan="{{ $colspan }}">{{ $monthText }}</th></tr>
<tr>
@foreach($theader as $thead)
@if($thead == "Email")
@continue
@endif
<th>{{ $thead }}</th>
@endforeach
</tr>
</thead>
<tbody>
@foreach($records as $record)
<tr>
@foreach($record as $key=>$value)
@if($key == "Email")
@continue
@endif
<td>{{ $value }}</td>
@endforeach
</tr>
@endforeach
</tbody>
</table>
<table>
<thead>
<tr><th colspan="{{ $colspan }}">Month to Date (MTD)</th></tr>
<tr>
@foreach($theader as $thead)
@if($thead == "Email")
@continue
@endif
<th>{{ $thead }}</th>
@endforeach
</tr>
</thead>
<tbody>
@foreach($records as $record)
<tr>
@foreach($record as $key=>$value)
@if($key == "Email")
@continue
@endif
<td>{{ $value }}</td>
@endforeach
</tr>
@endforeach
</tbody>
</table>
关于如何获得并排导出excel表的任何想法,目前,我得到了两个相互下方的表,我希望它们并排
class TopFiveExport implements FromView, WithTitle
{
protected $data;
protected $sheetTitle;
function __construct($result,$parameters)
{
$this->sheetTitle = $parameters['title'];
$this->data['theader'] = array_keys($result[0]);
$this->data['records'] = $result;
$this->data['colspan'] = $parameters['colspan'];
$this->data['monthText'] = $parameters['monthText'];
}
public function view(): View
{
return view('exports.backoffice.top5',$this->data);
}
public function title(): string
{
return $this->sheetTitle;
}
}