I copied this code from PhpSpreadsheet's documentation and it does not work.
This example can be found on this page:
LINK to PhpSpreadsheet's documentation
From the above link
My code:
$sheet->getCell('A2')->setValue(19);
$sheet->getStyle('A2')->getNumberFormat()->setFormatCode('0000');
// will show as 0019 in Excel
But its not working and this is the result:
The expected value of cell $A2 should be 0019 but it shows 19.
Any idea on how to fix this?