Laravel-excel: 一部/すべてのシートがFromViewを実装している場合、複数のシートが機能しない

作成日 2018年03月26日  ·  3コメント  ·  ソース: Maatwebsite/Laravel-Excel

前提条件

  • []コードの外部で動作を再現できるため、問題はLaravelExcelに限定されます。
  • [X]問題がまだ提出されていないことを確認しました。
  • [X]この問題を修正するPRが送信されていないかどうかを確認しました。

バージョン

  • PHPバージョン:7.2
  • Laravelバージョン:5.5
  • パッケージバージョン:3.0.1

説明

一部/すべてのシートがFromViewの場合、複数のシートが機能しない

  • FromViewを実装しているすべてのシート(機能していません)
  • 1枚のFromViewと別の実装FromCollection(機能していません)
  • 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')

@foreach($ reports as $ report)@endforeach
作成日
{{$ report ['created_at']}}

@ endsection`

予想される行動:

ビューに基づいた複数のシートを含むExcelファイル。

実際の動作:

image

bug

最も参考になるコメント

全てのコメント3件

チケットを提出していただきありがとうございます。 リソースが利用可能になり次第、それを受け取ります(サポートガイドライン(https://laravel-excel.maatwebsite.nl/docs/3.0/getting-started/support)に記載されています)。

おそらく#1590で解決されるでしょう

このページは役に立ちましたか?
0 / 5 - 0 評価