Rule based content rendering in Aspose.Words for Java

Hi,
I need to be able to setup a Word template with data field place holders and render content based on a set of rules. I have looked at the mail merge functionality but this didn’t answer this question.
For example:

IF <Customer_Gender> is "Male" THEN
    Display "Hello Sir"
ELSE
    Display "Hello Madam"
END IF

This is a simple example of course - in reality, there could be multiple rules that determine what needs to be rendered.
Can you please let me know how this can be achieved in Aspose.Words and also how the document template needs to be setup?
Rgs,
Kunal.

Hi Kunal,

Thanks for your inquiry. I have attached a template Word document which contains a merge field inside IF field which will help you to achieve what you’re looking for:

Document doc = new Document(MyDir + @"in.docx");
doc.MailMerge.Execute(new string[] { "Customer_Gender" }, new object[] { "Male" });
doc.Save(MyDir + @"out.pdf");

I hope, this helps.

Best regards,