How can I verticaly align center cells with laravel Excel ?
My code :
$sheet->cells('A1:'.$column_end.$i, function ($cells) {
$cells->setBackground('#d8d8d8');
$cells->setFontWeight('bold');
$cells->setValignment('middle');
});
But it doesn't work, most of my cells are vertically align bottom.
Maybe it's not middle !
I tried 'center' but it didn't work neither. When I tried 'top' or 'bottom' it worked.
So why 'middle' or 'center' didn't ?
Thank for your help.
According to Laravel Excel Documentation, it should be:
$cells->setValignment('center');
Like you mentioned...
Try as a test, the setAlignment('center')
, according to it, the behavior should be the same but for horizontal. If this one works, then the other one should for sure.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With