Laravel-excel: Setting border colors

Created on 25 Dec 2015  路  4Comments  路  Source: Maatwebsite/Laravel-Excel

Is it possible to change the border color of a cell? Or do I need to use PHPExcel native functions?

Most helpful comment

I made it work by setting style information:

$sheet->setStyle([
    'borders' => [
        'allborders' => [
            'color' => [
                'rgb' => 'AAAAAA'
            ]
        ]
    ]
]);

Later I define where I want to have borders:
$cell->setBorder('none', 'none', 'thin', 'none');

All 4 comments

Do you resolve it?

I made it work by setting style information:

$sheet->setStyle([
    'borders' => [
        'allborders' => [
            'color' => [
                'rgb' => 'AAAAAA'
            ]
        ]
    ]
]);

Later I define where I want to have borders:
$cell->setBorder('none', 'none', 'thin', 'none');

this working for me, edit this files https://gist.github.com/jasson112/bbcd256c42df336dc3ec9b49abecfbf2
and that should works with one parameter like this $sheet->setBorder('B16:T16', 'thin', "D8572C");

this working for me, edit this files https://gist.github.com/jasson112/bbcd256c42df336dc3ec9b49abecfbf2
and that should works with one parameter like this $sheet->setBorder('B16:T16', 'thin', "D8572C");

@jasson112 thank you for this. However, this applies border color to the outer borders of the range only. Would you happen to know how to do this to every individual cell? Similar to the "All borders" feature of excel.

Was this page helpful?
0 / 5 - 0 ratings