I’m evaluating Aspose.Words product and I cannot find how to use if statements with merge field. Can you please give me an example. I’ve tried to write simple if statement in Word document (like { IF { MERGEFIELD show } = true “Show” “Don’t show” } and in my Java code I’ve used document.getMailMerge().execute(keys, values); I’ve put key show and value true, but it seems that Aspose is not processing this if statement. Am I missing something?
Please see TestDocs.zip (17.7 KB) and try running the following code:
Document doc = new Document("D:\\temp\\input.docx");
doc.getMailMerge().execute(new String[]{"show"}, new String[]{"true"});
doc.save("D:\\temp\\awjava-18.2.docx");
this example works. Thank you for your help!
Can you please describe the process of creating this IF statement in MS Word? When I open input.docx
file you’ve sent, I cannot edit this field. And if I try to create such field in my template it’s not working as
one you’ve sent.