WPCubed Product Support

Merge fields in header or footer

rackerson

Delphi 6, WPTools 6.08
I currently have mail merge functionality working correctly throughout my documents, with one exception.
If I place a merge field in either a header or a footer, variable substitution is not occuring. Instead, the variable name remains.
For instance, if I take the variable <<Account>> and place it in my document's body, the code in the OnMailMergeGetText event properly replaces this with valid database values, such as A00561289.

However, if I place the same merge variable in my header or footer, the code in the OnMailMergeGetText event turns <<Account>> into Account.

Is there something special I need to do for merge variables to be "seen" correctly by the MailMergeGetText event when the variable resides in a header/footer?

#1 ♥ 0
4.4k Views 2 users read 1 min
support

Please call

MergeText('', true)

to also process header + footer.

Regards,

Julian

#2 ♥ 0
rackerson

Worked perfect, thanks!

As it turns out, I was using MergeActiveText. I completely forgot about the header, footer, and document body being considered different data blocks and that only one would be active. Thus I had accidentally been telling WPTools to skip the header and footer all along!

#3 ♥ 0
This category is archived. No new posts are possible.