Skip to content

Commit

Permalink
Merge pull request #1 from robgeorgeuk/master
Browse files Browse the repository at this point in the history
Find and replace in header.
  • Loading branch information
igorrebega authored Mar 2, 2018
2 parents 62a43d1 + ded5c19 commit 5ffbb68
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Docx.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';

/**
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -174,4 +176,4 @@ private function getNumberFromRelId($relId)
preg_match('!\d+!', $relId, $matches);
return (int)$matches[0];
}
}
}

0 comments on commit 5ffbb68

Please sign in to comment.