Replace placeholders in targets
If you need to replace placeholders in other targets, use the target option, available in all methods. This way, it is possible to exchange placeholders in any target: document, header, footer, footnote, endnote and comment.
For example, this following code replaces a placeholder called VAR_NAME in the body of the document, as the target is not specified.
If there's a placeholder in the header that you would like to replace, just set the target with header as its value.
You may have noticed that the target option allows one single value. Replacements of placeholders in different targets require to execute the method as many times as targets are.
It is also possible to exchange a placeholder in all targets. Write this snippet to do so: