From ded5c198bdf12e9850dcec8964b094abc92a74d1 Mon Sep 17 00:00:00 2001 From: Rob George Date: Fri, 2 Mar 2018 14:23:45 +0000 Subject: [PATCH] Find and replace in header. --- src/Docx.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Docx.php b/src/Docx.php index cadb257..0d3dffc 100644 --- a/src/Docx.php +++ b/src/Docx.php @@ -15,6 +15,7 @@ class Docx extends \ZipArchive const PX_TO_EMU = 8625; const REL_LOCATION = 'word/_rels/document.xml.rels'; const DOCUMENT_BODY_LOCATION = 'word/document.xml'; + const HEADER_LOCATION = 'word/header1.xml'; const FOOTER_LOCATION = 'word/footer1.xml'; /** @@ -43,6 +44,7 @@ public function __construct($path) */ public function replaceText($from, $to) { + $this->replaceTextInLocation($from, $to, self::HEADER_LOCATION); $this->replaceTextInLocation($from, $to, self::FOOTER_LOCATION); $this->replaceTextInLocation($from, $to, self::DOCUMENT_BODY_LOCATION); } @@ -174,4 +176,4 @@ private function getNumberFromRelId($relId) preg_match('!\d+!', $relId, $matches); return (int)$matches[0]; } -} \ No newline at end of file +}