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

Free Support Forum - aspose.com

Using 'IF' condition, format differently

Trying to know how to use IF conditions to format differently
a bunch of items I am looping through
basically how do I state this in the mustache template.
A sample will help. Regards.


Thanks for your inquiry. We suggest you please read the following article.
Conditional Block using ‘Mustache’

If you still face problem, please share some more detail about your query along with sample input and output documents. We will then provide you more information about your query.

IF_query_sample-files.zip (44.6 KB)
Described what I need to do with an example.
Have the input data xml as in test_input.xml;
has a series of Items, each having Description, Rating
Rating can have ‘Low’, ‘Medium’,‘High’ values.

need to only list them using a simple mustache template, test_template.docx, to do so.
get the output as in test_Output.docx.

what is desired is to two things
i) list the items in order of Rating
first list all with ‘High’ rating first, then of ‘Medium’ Rating and then ‘Low’ Rating
ii) color code background Red those with ‘High’ rating, yellow the ‘Medium’ Rated items and green color code the ‘Low’ Rating items.
the output document should look like test_Output_desired.docx.

assume can be managed tweaking the template docx. 

All the files mentioned in the .zip.

Looking for advise on this? Thanks.


In your case, we suggest you please use the LINQ Reporting Engine to achieve your requirement. Please read the following articles.
Template Syntax
Using Conditional Blocks

If you still want to use Mustache syntax, please check the attached modified template document. Hope this helps you.
test_template.zip (17.8 KB)

Thanks; it helps.