Skip to content

Commit 2187954

Browse files
author
Bas-Jan 't Jong
committed
Fixed bug in header, wherein all images were assigned to the first
header in a section. This resulted in a corrupt DOCX
1 parent 9c11067 commit 2187954

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/PhpWord/Element/AbstractContainer.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ public function addImage($src, $style = null, $isWatermark = false)
249249
$rId = Media::addElement($elementDocPart, 'image', $src, $image);
250250
$image->setRelationId($rId);
251251
$this->addElement($image);
252-
253252
return $image;
254253
}
255254

@@ -413,7 +412,7 @@ private function checkElementDocPart()
413412
$docPart = $isCellTextrun ? $this->getDocPart() : $this->container;
414413
$docPartId = $isCellTextrun ? $this->getDocPartId() : $this->sectionId;
415414
$inHeaderFooter = ($docPart == 'header' || $docPart == 'footer');
416-
415+
$docPartId = $inHeaderFooter ? $this->getDocPartId() : $docPartId;
417416
return $inHeaderFooter ? $docPart . $docPartId : $docPart;
418417
}
419418

0 commit comments

Comments
 (0)