Free Support Forum - aspose.com

MergeField inside IF in header / footer issue

Hello,


I need to show merge field in the footer of document depending on certain condition (in the sample below, depending on page). It works just fine for document body but it seems like fields are NOT merged when put inside IF statement in footer / header. Please advise.

----------------------------------------------------------------
Sample 1: this is what i try to do in footer, City merge field is not merged at all
Template:
{ IF { PAGE } = “1” “{ MERGEFIELD City }” “” }
Result:
{ IF { PAGE } = “1” “{ MERGEFIELD City }” “” }
----------------------------------------------------------------
Sample 2: the same in body works OK
Template:
{ IF { PAGE } = “1” “{ MERGEFIELD City }” “” }
Result:
{ IF { PAGE } = “1” “London” “” }
----------------------------------------------------------------
Sample 3: merging the same field in footer without IF works just fine
Template:
{MERGEFIELD City}
Result:
London
----------------------------------------------------------------



Hi Vasily,


Thanks for your inquiry. Perhaps, you’re using an older version of Aspose.Words; as with Aspose.Words v11.9.0, I was unable to reproduce this problem on my side. I would suggest you please upgrade to the latest version of Aspose.Words i.e. v11.9.0 and let us know how it goes on your side. I hope, this will help.

Please let us know if you have any more queries.