PHPWord
PHPWord copied to clipboard
Template replace not working in footer
Describe the Bug
Some of the word documents(docx) that we create have only word/footer.xml or word/header.xml for the footer/header information.
With this logic, it looks like they are being skipped from replacing as the TemplateReplacement logic in https://github.com/PHPOffice/PHPWord/blob/develop/src/PhpWord/TemplateProcessor.php#L119 and https://github.com/PHPOffice/PHPWord/blob/develop/src/PhpWord/TemplateProcessor.php#L124 only seem to look for documents with word/footer<number>.xml and word/header<number>.xml
Shouldnt it also check for the simple word/header.xml and word/footer.xml ?
Steps to Reproduce
Attached word document when expanded will show the word/footer.xml and word/header.xml.. Trying to run a template replace on this avoids replacing any tags that are available in the footer (Because of the logic mentioned above).
This seems to happen only on Word docs created online, not the desktop version
Expected Behavior
The expected behaviour is for all template variables to get replaced
Current Behavior
Only variables in the main body get replaced and not the header/footer
Context
- PHP Version: 5.6.39
- PHPWord Version: 0.16.0 installed using composer.
Test file
is there any update on this? i also having the same issue
no update on this?!