From 1a544cb2fa3c20015892fc19f5f5bce9448f5324 Mon Sep 17 00:00:00 2001 From: Bas-Jan 't Jong Date: Sun, 4 May 2014 10:36:13 +0200 Subject: [PATCH] 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. --- src/PhpWord/Element/AbstractContainer.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/PhpWord/Element/AbstractContainer.php b/src/PhpWord/Element/AbstractContainer.php index ea3450a5..b90f6d72 100644 --- a/src/PhpWord/Element/AbstractContainer.php +++ b/src/PhpWord/Element/AbstractContainer.php @@ -412,6 +412,7 @@ abstract class AbstractContainer extends AbstractElement $docPart = $isCellTextrun ? $this->getDocPart() : $this->container; $docPartId = $isCellTextrun ? $this->getDocPartId() : $this->sectionId; $inHeaderFooter = ($docPart == 'header' || $docPart == 'footer'); + $docPartId = $inHeaderFooter ? $this->getDocPartId() : $docPartId; return $inHeaderFooter ? $docPart . $docPartId : $docPart; }