Comments size

Nov 27, 2008 at 8:16 AM

I'm having some problems with the comments.

I'm adding comments to my sheet but no matter how much text they have inside they all have the same size which is most of the time too much

So I'd like to know if there is a way to make comments fit to their content.

Nov 27, 2008 at 3:50 PM
Unfortunately, there is no way to control the size of a comment in PHPExcel.

Now posted as a feature request:

Dec 5, 2013 at 2:28 PM
Edited Dec 5, 2013 at 2:29 PM
Try this:
        $sheet->getComment($ce)->getText()->createTextRun('Text of the comment...'); 
        $sheet->getComment($ce)->setHeight (300); // height set to 300
        $sheet->getComment($ce)->setWidth (400); // width set to 400
$ce is the address of the cell (A2 for instance).

The default values for height and width are 55.5pt and 96pt respectively.

The code is in the file Classes/PHPExcel/Comment.php (rows 170 to 190).