Page 1 of 1

Replace text in header or footer

PostPosted: Wed Jan 31, 2018 4:54 pm
by efritsch
Hi there,

Using docx4j 3.3.6
I am using the docx4j.DocumentHelper to work on an existing Word template.
Using DocumentHelper.replaceFirst() methods I am searching for text tags in the form of {{name}} to replace them with the real text.
Everything works fine as long as I am in the body but in the footer it doesn't work.
I checked, if the text tags have been ripped apart in the Xml (that was a problem from time to time since word has very funny ways of doing this) and that is not the case.
Is there something I need to do in order to work on the footer?
Since the tags in the footer only occur once I also tried replaceAll() but that didn't do the job either.

Re: Replace text in header or footer

PostPosted: Wed Jan 31, 2018 6:40 pm
by jason
What is DocumentHelper? Have you got a URL for it?

Whatever it is, you'll need to apply the method to the header and footer parts.

Re: Replace text in header or footer

PostPosted: Wed Jan 31, 2018 7:15 pm
by efritsch
Ups.
Sorry for this but I inherited this application from another developer.
I had seen the docx4j in the import path and had simply assumed that this was part of the package but it was something this developer had written. So I can change that and include the footer part.
Thanks for the help and sorry for my negligence when checking the code.