Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bobwurtz's avatar

Laravel Excel Export to PDF - Border Issue and Text Wrapping

Hello -

I am running into an issue trying to export a Laravel Excel doc as a PDF. The content is correct, but it generates borders that do not appear on the XLSX export. Currently, I am trying to apply default styles with:

public function defaultStyles(Style $defaultStyle)
    {
        return [
            'font' => [
                'size' => 16,
            ],
            'wrapText' => false,
            'borders' => [
                'right' => [
                    'borderStyle' => Border::BORDER_NONE,
                ],
                'left' => [
                    'borderStyle' => Border::BORDER_NONE,
                ],
                'top' => [
                    'borderStyle' => Border::BORDER_NONE,
                ],
                'bottom' => [
                    'borderStyle' => Border::BORDER_NONE,
                ],
            ]
        ];
    }

But it does not work. Any ideas?

Also, in the XLSX download, the text does not wrap at the end of the column (desired behavior). It is wrapping at the end of the column in the PDF download and I do not want that. Again, I have tried addressing it in the defaultStyles function but have not had any success. I'm guessing learning how to fix one will also allow me to fix the other.

Anyone have any ideas? Thank yoU!

0 likes
0 replies

Please or to participate in this conversation.