From 391e6308d7956d3c76a10aa5ae5a02879de795df Mon Sep 17 00:00:00 2001 From: dgeppo <107109388+dgeppo@users.noreply.github.com> Date: Wed, 8 Jun 2022 11:24:56 +0200 Subject: [PATCH] Add removeCommentByColumnAndRow function --- src/PhpSpreadsheet/Worksheet/Worksheet.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/PhpSpreadsheet/Worksheet/Worksheet.php b/src/PhpSpreadsheet/Worksheet/Worksheet.php index 4a441a93..d7288aa4 100644 --- a/src/PhpSpreadsheet/Worksheet/Worksheet.php +++ b/src/PhpSpreadsheet/Worksheet/Worksheet.php @@ -2581,6 +2581,22 @@ class Worksheet implements IComparable return $this; } + + + /** + * Remove comment. + * + * @param int $columnIndex Numeric column coordinate of the cell + * @param int $row Numeric row coordinate of the cell + * + */ + public function removeCommentByColumnAndRow($columnIndex, $row) + { + $pCellCoordinate = strtoupper(Coordinate::stringFromColumnIndex($columnIndex) . $row); + if(isset($this->comments[$pCellCoordinate])) { + unset($this->comments[$pCellCoordinate]); + } + } /** * Get comment for cell.