diff --git a/src/PhpSpreadsheet/Reader/Html.php b/src/PhpSpreadsheet/Reader/Html.php index 60bd7757..7bd1b31d 100644 --- a/src/PhpSpreadsheet/Reader/Html.php +++ b/src/PhpSpreadsheet/Reader/Html.php @@ -345,8 +345,9 @@ class Html extends BaseReader $sheet->getComment($column . $row) ->getText() ->createTextRun($child->textContent); + } else { + $this->processDomElement($child, $sheet, $row, $column, $cellContent); } - $this->processDomElement($child, $sheet, $row, $column, $cellContent); if (isset($this->formats[$child->nodeName])) { $sheet->getStyle($column . $row)->applyFromArray($this->formats[$child->nodeName]); diff --git a/tests/PhpSpreadsheetTests/Functional/CommentsTest.php b/tests/PhpSpreadsheetTests/Functional/CommentsTest.php index d82f7f96..03be3e00 100644 --- a/tests/PhpSpreadsheetTests/Functional/CommentsTest.php +++ b/tests/PhpSpreadsheetTests/Functional/CommentsTest.php @@ -40,8 +40,9 @@ class CommentsTest extends AbstractFunctional $commentCoordinate = key($commentsLoaded); self::assertSame('E10', $commentCoordinate); + self::assertSame('Comment', $sheet->getCell('E10')->getValue()); $comment = $commentsLoaded[$commentCoordinate]; - self::assertEquals('Comment to test', (string) $comment); + self::assertSame('Comment to test', (string) $comment); $commentClone = clone $comment; self::assertEquals($comment, $commentClone); self::assertNotSame($comment, $commentClone); @@ -51,5 +52,7 @@ class CommentsTest extends AbstractFunctional $comment->setAlignment(Alignment::HORIZONTAL_RIGHT); self::assertEquals(Alignment::HORIZONTAL_RIGHT, $comment->getAlignment()); } + $spreadsheet->disconnectWorksheets(); + $reloadedSpreadsheet->disconnectWorksheets(); } }