We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Build a Word mergefield using other fields to complete the name?

I have a list of images (one per state) that I need to pull into my template and normally use a regular mergefield e.g., {MERGEFIELD “Image_FL_09252017”}. The image name is a combination of the state and date which I also have tags for, so I’m trying to create a dynamic mergefield to choose the correct image based on state and date.

Something along the lines of

{MERGEFIELD “Image_{MERGEFIELD “State”}_{MERGEFIELD “Date”}”}

However, Word seems to process the outside mergefield first instead of the inside mergefields. If I use an IF statement I can include static text to complete the mergefield, but as soon as I use another field it doesn’t work. Is this something that’s even possible within Word? Any help or direction is greatly appreciated!

@ADixon

Thanks for your inquiry. Please share following resources here as ZIP file. We will further look into it and will guide you accordingly.

  • Your input Word document
  • Existing output Word document, showing undesired behavior.
  • Expected Word document, you can create it using MS Word and share steps to create it.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.