Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template replace not working in footer #2002

Open
rajasaur opened this issue Jan 9, 2021 · 2 comments
Open

Template replace not working in footer #2002

rajasaur opened this issue Jan 9, 2021 · 2 comments

Comments

@rajasaur
Copy link

rajasaur commented Jan 9, 2021

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

Karnan's Custom Form-1.docx

@FareedR
Copy link

FareedR commented May 11, 2023

is there any update on this? i also having the same issue

@robertnicjoo
Copy link

no update on this?!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants