I struggle a bit to make all the cells set the context to center and to autoexpand so it doesnt overlap each other.
So what I try to do is:
Set the info in every cell to be centered since it makes better for printing to PDF/etc.
Make the cells expand based on how much text there is in the cell. I dont want the the information in A to go over in cell B.
Ive tried this code but it doesnt seem to work:
$styleArray = array(
'borders' => array(
'outline' => array(
'style' => Alignment::HORIZONTAL_CENTER,
),
),
);
$sheet ->getStyle('A1:D30')->applyFromArray($styleArray);
Tho if I do it for one single cell (center context), it works. Did it like this:
$sheet->setCellValue('A2', $activitiesCount)->getStyle('A2')->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
For the cells expanding tho I havent found a solution for that to try yet.
I would love to do both on all my cells with only 1 command if possible.