Search code examples
phplaravellaravel-5phpexcellaravel-excel

Is it possible to add a border to an entire column with Laravel Excel?


With Laravel Excel, it's easy to add a border to a cell:

$sheet->cell('A1', function($cell) {
    $cell->setBorder('none', 'none', 'thin', 'none')
});

It's easy to add a border to a row too:

$sheet->row(3, function($row) {
    $row->setBorder('none', 'none', 'thin', 'none')
});

But I did not found anything about column (maybe I did not search well). Is it possible to add a border (or some other style) to a whole column?


Solution

  • You can do like this i think:

    $sheet->setBorder('A1:A10');
    

    This will set border to cells from A1 to A10. so you need to know the length of your column i guess.