Page 1 of 1

VariableReplace in footer now working

PostPosted: Thu Apr 18, 2019 4:29 am
by steveEP
I currently do a variable replace on the body of the document successfully (using a template with placeholders), but have not been able to replace the footer placeholders.

My code:

Code: Select all
RelationshipsPart rp = wordMLPackage.getMainDocumentPart().getRelationshipsPart();
         for (Relationship r : rp.getRelationships().getRelationship()) {
                 if (r.getType().equals(Namespaces.FOOTER)) {
               FooterPart fp = ((FooterPart) rp.getPart(r));
                                        // setup is a HashMap(String, String), the same one I use for the other variable replace which is working on the MainDocumentPart
               fp.variableReplace(setup);
            }
         }



In the template, I have the placeholders like this: ${myPlaceholder}

And the only thing that is happening is that the ${ and } are getting removed resulting in just: myPlaceholder


Thanks for any help!

Re: VariableReplace in footer now working

PostPosted: Thu Apr 18, 2019 10:23 am
by jason
seems weird. please post sample docx + data