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

Free Support Forum - aspose.com

Mail Merge problem with Multi-nested TableStart with IF statement

We have just recently upgrade to the latest version of Aspose, which changes the behavior of the IF Mail Merge condition so that both the "true" and "false" portions process the mail merge fields. This is something that we really need to have fixed but we have a problems with the way this was implemented. I have attached a sample application that shows the problem and I will describe it below...

We implemented a custom data source using IMailMergeDataSource. This data source may contain a child list so we added code to the GetChildDataSource. There seems to be now way to know identify the current record we assume the GetChildDataSource is called once per record and so we increment a value by 1 every time the GetChildDataSource is called.

This is now a problem if we have the child TableStart/TableEnd statements in both the "true" and "false" portions of the IF statement because now the GetChildDataSource is being called twice per record. Since our customer defines the Mail Merge document we have no way of knowing whether there are one or two TableStarts per row.

Is there any way within Aspose we can determine whether the current row has changed between the GetChildDataSource calls?

Any other suggestion you could provide where there is some Aspose functionality that would help us resolve this issue?

On another note: personally I believe you have implemented the IF statement incorrectly. You should still only process the MERGEFIElDS within the "true" portion of the statement, and then just automatically delete all the MERGEFIELDS in the "false" portion of the statement.

Hi there,

Thanks for your inquiry. It would be great if you please share following detail for investigation purposes.

  • Please attach the output Word file that shows the undesired behavior.
  • Please attach your target Word document showing the desired behavior. You can use Microsoft Word to create your target Word document. I will investigate as to how you are expecting your final document be generated like.

As soon as you get these pieces of information to us we'll start our investigation into your issue.

Ignore this post. I figured it out. It was the way in which we implemented the GetChildDataSource. Fixed our code and this is working as expected. Thanks for taking your time to review this.

Hi there,


Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.