一部/すべてのシートがFromViewの場合、複数のシートが機能しない
`
クラスFormatReportExportは、WithMultipleSheets、Responsableを実装します
{{
Exportableを使用します。
protected $reports;
protected $summary;
public function __construct($summary, $reports)
{
$this->summary = $summary;
$this->reports = $reports;
}
public function sheets(): array
{
$sheets = [];
$sheets[] = new ReportSummaryExport($this->summary);
$sheets[] = new ReportExport($this->reports);
return $sheets;
}
}
`
`
クラスReportSummaryExportは、FromCollection、WithTitleを実装します
{{
保護された$ summary;
public function __construct($summary)
{
$this->summary = $summary;
}
public function collection()
{
return User::get();
}
/**
* <strong i="34">@return</strong> string
*/
public function title(): string
{
return 'Summary';
}
} `
`クラスReportExportは、FromView、WithTitleを実装します
{{
保護された$ reports;
public function __construct($reports)
{
$this->reports = $reports;
}
public function view(): View
{
return view('export.report.list', [
'title' => $this->title(),
'reports' => $this->reports
]);
}
/**
* <strong i="41">@return</strong> string
*/
public function title(): string
{
return 'Checklists';
}
} `
list.blade.php
`@extends( 'layouts.export'、['title' => $ title])
@section( 'content')
作成日 |
{{$ report ['created_at']}} |
@ endsection`
予想される行動:
ビューに基づいた複数のシートを含むExcelファイル。
実際の動作:
チケットを提出していただきありがとうございます。 リソースが利用可能になり次第、それを受け取ります(サポートガイドライン(https://laravel-excel.maatwebsite.nl/docs/3.0/getting-started/support)に記載されています)。
おそらく#1590で解決されるでしょう
最も参考になるコメント
https://github.com/Maatwebsite/Laravel-Excel/releases/tag/3.0.2