Help with Aspose.Words Conditionals

Hi,


We are currently evaluating to migrate to Aspose.Word for .NET from XSLT templates. One thing that we have not found if it is possible to do is to use some kind of variable dependent behavior in the documents (similar to the if and foreach one can use to manage the elements of an xslt), so we can define for example a report with a single element that will be multiplied as many times as needed based on a variable count, and that will have certain elements only if specific variables are not empty.

Thanks for any help you can provide.

Regards,

Marcel

Hi Marcel,


Thanks for your interest in Aspose.Words. Sure, you can achieve this using the mail merge capabilities of Aspose.Words. Please refer to the following sections of documentation which outlines everything you need to know about mail merge and reporting:
http://www.aspose.com/docs/display/wordsnet/Mail+Merge+and+Reporting

Please let us know if you have any troubles and we will be glad to look into this further for you.

Best regards,

Thanks Awais!. Let me check the documentation and I will get back to you.

Hi Awais,


I have read the mail merge section of the documentation and found it quite useful. However, i still have several doubts. I will be creating the merging datasets mostly from complex XMLs. I will be using IF and Foreach a lot, so I would like to know if there is some specific notation to access fields from parent regions or from different regions inside a foreach or an if. Please consider the following example:

<?xml version="1.0" encoding="utf-8"?>
Other stuff I want to acess inside a foreach in order-Item
23
Nelson Street
Howick
Auckland
543 1234
03/01/2010
14.00
BBQ Chicken Pizza
6.00
1
6.00
1.5 Litre Coke
4.00
2
8.00
I want to access this field


{{#foreach Item}}{{Name}}

{{/foreach Item}}

How could I access the field "Name" that is at the same level of Order from inside the "Item" foreach? how could I access the fiel "Name" that is inside "OtherStuff" from inside the "Item" foreach? Same for the IF cases (Specify which want of the "Name" field I want to use).

Thanks in advance.

Marcel

Hi Marcel,


Thanks for your inquiry. I am afraid, this is currently not possible. In future, we will consider providing access to underlying data source during mailmerge i.e. you would be able to obtain a handle to your data source inside IFieldMergingCallback.FieldMerging method. Will such an ability satisfy your requirement?

Best regards,