7

I am trying to insert a comment with in a cell. I am trying following code to comment but it is not showing comment within created excel. I am creating .xls extension.

$objPHPExcel->getActiveSheet()->getComment('E11')->setAuthor('Efusionsoft');
$objCommentRichText = $objPHPExcel->getActiveSheet()->getComment('E11')->getText()->createTextRun('PHPExcel:');
$objCommentRichText->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getComment('E11')->getText()->createTextRun("\r\n");
$objPHPExcel->getActiveSheet()->getComment('E11')->getText()->createTextRun('Total amount on the current invoice, excluding VAT.');
Amit Garg
  • 3,867
  • 1
  • 27
  • 37
  • That is just the sample code from the documentation, show the rest of your code. – AndreKR Jan 04 '13 at 06:58
  • @AndreKR Thanks. Whole code is too big to be here. Everything is working fine but comment is not being shown – Amit Garg Jan 04 '13 at 07:03
  • Wait for Mark Baker to look at this question. He will surely answer this question satisfactorily, though i would like to make it prestine that i am not underestimating anyone else. – Bhavik Shah Jan 04 '13 at 07:10
  • Ok, you're right, that sample code doesn't work with the Excel5 writer. And there is no support for comments in the code. – AndreKR Jan 04 '13 at 07:18

1 Answers1

7

There is no support for comments in the Excel5 writer. Use the Excel2007 writer to create an .xlsx file.

AndreKR
  • 32,613
  • 18
  • 106
  • 168
  • Oh yes!. Thanks a lot. I was struggling with the same thing mentioned in this question and you solved it. Thanks a lot once again. – Bhavik Shah Jan 04 '13 at 09:14
  • @AndreKR can you provide example – shorif2000 Jul 16 '18 at 10:52
  • There are plenty of [examples](https://github.com/PHPOffice/PHPExcel/blob/develop/Documentation/markdown/Overview/10-Reading-and-Writing.md) on the web. Please note the PHPExcel is deprecated in favor of PHPOffice/PhpSpreadsheets. – AndreKR Jul 16 '18 at 16:44