我已经读过https://laravel-excel.maatwebsite.nl/3.0/exports/from-view.html,但其中没有一个内容说明如何对表格进行样式设置。
public function print(Request $request)
{
$this->validate($request, [
'start_date' => 'required|date',
'end_date' => 'required|date',
]);
return (new JobsExport($request->input('start_date'),$request->input('end_date')))->download('business_travel.xlsx');
}
这是我的刀片:
<table align="center" width="100%" style="border:1px solid #000">
<tr><th colspan="10">TITLE</th></tr>
<tr><th colspan="10">SUBTITLE 1</th></tr>
<tr><th colspan="10">SUBTITLE OF SUBTITLE 1</th></tr>
<tr>
<th rowspan="2">No</th>
...
<th colspan="6">Biaya</th>
</tr>
<tr>
<th>UANG HARIAN</th>
...
<th>JUMLAH</th>
</tr>
@foreach ($jobs as $index=> $joddetail)
<tr>
<th>{{ $index+1 }}</th>
...
<th>{{ $joddetail->other_cost }}</th>
</tr>
@endforeach
</table>
答案 0 :(得分:1)
直接使用phpspreadsheet(https://phpspreadsheet.readthedocs.io/en/develop/)比使用laravel-excel更容易。
谢谢