Skip to content

Commit

Permalink
[BUGFIX] Respect wrapped paragraph in table cells
Browse files Browse the repository at this point in the history
This change ensures that `w:sdt->w:sdtContent` wrapped
table cell content is properly read and respected.
  • Loading branch information
sbuerk committed Apr 2, 2024
1 parent 8b891bb commit f3dc981
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/PhpWord/Reader/Word2007/AbstractPart.php
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,13 @@ protected function readTable(XMLReader $xmlReader, DOMElement $domNode, $parent,
$this->readParagraph($xmlReader, $cellNode, $cell, $docPart);
} elseif ($cellNode->nodeName == 'w:tbl') { // Table
$this->readTable($xmlReader, $cellNode, $cell, $docPart);
} elseif ('w:sdt' == $cellNode->nodeName) {
if ($xmlReader->elementExists('w:sdtContent/w:p', $cellNode)) {
$cellParagraphNode = $xmlReader->getElement('w:sdtContent/w:p', $cellNode);
if ($cellParagraphNode instanceof DOMElement) {
$this->readParagraph($xmlReader, $cellParagraphNode, $cell, $docPart);
}
}
}
}
}
Expand Down

0 comments on commit f3dc981

Please sign in to comment.