Hello,
is there a way to add comments to a cell in Laravel Excel 3.1?
I am looking for it in github, maatwebsite & google but the only reference that I have found is https://github.com/Maatwebsite/Laravel-Excel/issues/618#issuecomment-164880255 but it doesn't work.
I am trying to add the comments in registerEvents() inside AfterSheet::class anon function.
I wrote the following statement:
$event->sheet->getDelegate()->getComment('A3')->getText()->createTextRun('Your comment:');
Thank you!
According to PhpSpreadsheet docs (https://phpspreadsheet.readthedocs.io/en/latest/topics/recipes/#add-a-comment-to-a-cell):
$event->sheet->getDelegate()->getComment('E11')->getText()->createTextRun('Your comment:')
AfterSheet event should be fine I think. Make sure you use xlsx.
Thank you so much @patrickbrouwers, the problem was I was using .xls and it doesn't work.
With xlsx it works like a charm!
Most helpful comment
According to PhpSpreadsheet docs (https://phpspreadsheet.readthedocs.io/en/latest/topics/recipes/#add-a-comment-to-a-cell):
$event->sheet->getDelegate()->getComment('E11')->getText()->createTextRun('Your comment:')AfterSheet event should be fine I think. Make sure you use xlsx.