Skip to content

Commit 1a544cb

Browse files
author
Bas-Jan 't Jong
committed
Fixed bug in header / footer, in which media elements were all assigned
to the first header element. This resulted in a corrupted DOCX, when a media element was assigned to a second header in the same section.
1 parent 15dcb38 commit 1a544cb

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/PhpWord/Element/AbstractContainer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ private function checkElementDocPart()
412412
$docPart = $isCellTextrun ? $this->getDocPart() : $this->container;
413413
$docPartId = $isCellTextrun ? $this->getDocPartId() : $this->sectionId;
414414
$inHeaderFooter = ($docPart == 'header' || $docPart == 'footer');
415+
$docPartId = $inHeaderFooter ? $this->getDocPartId() : $docPartId;
415416
return $inHeaderFooter ? $docPart . $docPartId : $docPart;
416417
}
417418

0 commit comments

Comments
 (0)