Skip to content

Commit 1bd6155

Browse files
committed
Hotfix: In headings hyperlinks are ignored. Added w:hyperlink to xpath filter
1 parent 7743802 commit 1bd6155

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/PhpWord/Reader/Word2007/AbstractPart.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,11 @@ protected function readParagraph(XMLReader $xmlReader, DOMElement $domNode, $par
151151
} elseif ($headingDepth !== null) {
152152
// Heading or Title
153153
$textContent = null;
154-
$nodes = $xmlReader->getElements('w:r', $domNode);
154+
// 2023-08-02 hannes@dorn.cc
155+
// $nodes = $xmlReader->getElements('w:r', $domNode);
156+
// delivers only text paragraphs, but no hyperlinks
157+
// I extended xpath with w:hyperlink
158+
$nodes = $xmlReader->getElements('w:r|w:hyperlink', $domNode);
155159
if ($nodes->length === 1) {
156160
$textContent = htmlspecialchars($xmlReader->getValue('w:t', $nodes->item(0)), ENT_QUOTES, 'UTF-8');
157161
} else {

0 commit comments

Comments
 (0)