Search code examples
phphtmldompdflaravel-excelmaatwebsite-excel

How to remove right column generated by maatwebsite-excel (Laravel Excel)?


I have next simple template:

<!doctype html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style>
        * {
            font-family: DejaVu Sans, sans-serif;
            font-size: 10pt;
        }
        table.data td {
            border: 1px solid #f44;
        }
        table, table td {
            border: 0px dotted #88ff88;
            width: 0px;
            visibility: hidden;
        }
    </style>
</head>
<body>
    <table class="data">
        <thead>
            <tr>
                <td>cell 1</td>
                <td>cell 2</td>
            </tr>
            <tr>
                <td>cell 3</td>
                <td>cell 4</td>
            </tr>
            <tr>
                <td>cell 5</td>
                <td>cell 6</td>
            </tr>
        </thead>
    </table>
</body>

And I store generated file into pdf using Laravel Excel and DomPDF driver.

Excel::create('test', function($excel) use ($data, $reportProperties)
{
    $excel->sheet('Report', function($sheet)
    {
        $sheet->setOrientation('portrait');
        $sheet->loadView('export.activity');
    });
})->store('pdf');

And I get next result:

enter image description here

My question is how to remove right column?


Solution

  • I solved problem using barryvdh/laravel-dompdf package without middleware maatwebsite-excel:

    App::make('dompdf.wrapper')
        ->loadView('export.activity')
        ->save($fileName);