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

Free Support Forum - aspose.com

Trouble with IF Clause in MERGEIELD

I’m new in this forum.
If have touble with using IF Clauses for Mergefield.

{ IF { MERGEFIELD status } = "Com" "Yes" "No" }

But every time i getting the error.
“Error! Unknown op code for conditional.”

In attachement I send you my files. I think my IF Clause in the template is incorrect.

I have seen a view items for this trouble, however I can’t find an error in my sample.

Thanks for support


Hi Thomas,

Thanks for your inquiry.

The issue you are facing is due to your merge field not being a real field. It is actually just plain text with brackets. You need to remove this text and reinsert it as a proper merge field e.g Insert -> QuickParts -> Field.

If you need any further assistance, we will be glad to help.


Hi Adam,
thanks for this quick answer.
I tried to generate this MERGE FIELD. Unfortunatly everytime the Dialagbox selected a IF Field.
Please have a look on my screenshot.
Could you you try to generate this field from your site?

Hi Thomas,

Thanks for this additional information.

I have modified your template for you and attached the new document here.

It looks like you tried to click “Edit Field” on the if field. I’m afraid this screen won’t allow you to add a nested field. Instead you need to toggle field codes (ALT+F9) and place the cursor inside the IF field and use the Insert field command.

The video here should help assist with setting up fields for mail merge in a document: https://docs.aspose.com/words/net/mail-merge-template/

If we can help with anything else, please feel free to ask.


Hi Adam,
thank you for support.
Your example runs fine.
I’m very happy.

Best regards

Hi Thomas,

Thanks for this additional information.

It’s great things are working for you. Please let us know any time you have any queries. We are glad to help.