maatwebsite превосходит несколько столов бок о бок - PullRequest
0 голосов
/ 26 февраля 2019

У меня есть код, который создает электронную таблицу из Maatwebsite, я использую Laravel 5.7,

У меня есть код, описанный ниже: 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;
    }

}

Любая идея о том, как получить Excel экспорт таблиц рядом, в настоящее время я получаю две таблицы друг под другом, яхочу, чтобы они были рядом.

...