Skip to content

Commit f3dc981

Browse files
committed
[BUGFIX] Respect wrapped paragraph in table cells
This change ensures that `w:sdt->w:sdtContent` wrapped table cell content is properly read and respected.
1 parent 8b891bb commit f3dc981

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/PhpWord/Reader/Word2007/AbstractPart.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,13 @@ protected function readTable(XMLReader $xmlReader, DOMElement $domNode, $parent,
493493
$this->readParagraph($xmlReader, $cellNode, $cell, $docPart);
494494
} elseif ($cellNode->nodeName == 'w:tbl') { // Table
495495
$this->readTable($xmlReader, $cellNode, $cell, $docPart);
496+
} elseif ('w:sdt' == $cellNode->nodeName) {
497+
if ($xmlReader->elementExists('w:sdtContent/w:p', $cellNode)) {
498+
$cellParagraphNode = $xmlReader->getElement('w:sdtContent/w:p', $cellNode);
499+
if ($cellParagraphNode instanceof DOMElement) {
500+
$this->readParagraph($xmlReader, $cellParagraphNode, $cell, $docPart);
501+
}
502+
}
496503
}
497504
}
498505
}

0 commit comments

Comments
 (0)