I tried exporting my PHPSpreadsheet as a PDF. What I did was setting the header like:
header("Content-Disposition: attachment;filename=hello world.pdf");
and the $writer like this:
$writer = new \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf($spreadsheet);
$writer->save("php://output");
The rest of my code stays the same as for exporting as XLSX. It seems to not like the styling commands and also imports the cells where there is no text. An example of how I create info in a cell for Excel is like this:
$sheet->setCellValue('A16', $activitiesCount)->getStyle('A16');
$sheet->getStyle('A16')->getFill()->setFillType(Fill::FILL_SOLID);
$sheet->getStyle('A16')->getFill()->getStartColor()->setARGB('d9e6fc');
Here is the original in excel:
This one exports fine if I save it as PDF directly from excel itself. But when I try to do it with my code, this seems to be the result:
As you can see its getting really messy. Does it mean I have to program it in a another way for PDF? I thought it was going to be easy to change between those to.
PS: Dont mind the name differences between the pictures. I tested something in DB to see how it scales when name is really long. It wasnt pretty, let me tell you.

