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

Free Support Forum - aspose.com

Issue with Mustache “IF” statement

Hello,

We are evaluating transitioning to the Aspose Java Total product, but I’m having similar issues as this ticket. I need to provide a go/no-go decision by mid-week. We are ready to commit to Aspose, but if we can’t get this working, I’ll have to use Apache POI etc.

I’m trying to use the Java Mustache Syntax for mail merge using custom tags and an external data source. I pulled the latest version of the examples from GitHub (uses aspose-words-18.11-jdk16.jar).

I seem to be chasing my tail a bit trying to locate the complete Mustache documentation. There is partial Mustache documentation, but doesn’t include the full feature set (eg. “if”, “if/else”…).

From looking at the docs/forums and playing with the sample code, I’m starting to wonder if I should switch the XML tag syntax format used by LINQ reporting engine.

Below are additional forum links:

Thanks,
Erik

Can you share this file with me? I’m trying to solve a similar issue… Thanks, Erik

Can you also share this file with me? I’m trying to solve a similar issue… Thanks again, Erik

@ewestland,

Thank you for your interest in Aspose.Words for Java.

Yes, LINQ Reporting Engine is more advanced and we would recommend it to you.

Regarding the if-else ‘Mustache’ template syntax example, please see the sample input, output documents and screenshot in this archive (Mustache-Template-Syntax.zip (38.5 KB)) and try running the following code:

Document doc = new Document("E:\\Mustache-Template-Syntax\\input.docx");
doc.getMailMerge().setUseNonMergeFields(true);
doc.getMailMerge().execute(new String[]{"GENDER"}, new Object[]{"MALE"});
doc.save("E:\\Mustache-Template-Syntax\\awjava-18.12.docx");

Hope, this helps.

A post was split to a new topic: IF-ELSE Mustache Template Syntax Example