Filter Table in Mail Merge

Hi, I need to filter data in Mail Merge. I need to filter in Word Document, not programmatically with dataviews, etc…

I only find two options and I need help in both.

1.- Filter the data in parameters o something in “TableStart” mergefield. Exist something like this?

2.- I can “filter” with IF fields in the table, but I need to delete blank rows after mail merge. I have something like this:

Column1 Column2
{ MERGEFIELD "TableStart:DataTable1" { IF { MERGEFIELD "Type" = "A" { MERGEFIELD "Column1" } "" } { MERGEFIELD "TableStart:DataTable1" { IF { MERGEFIELD "Type" = "A" { MERGEFIELD "Column2" } "" }

And the result:

Column1 Column2
Data Column 1 Row 1 Data Collumn 2 Row 1
Data Column 1 Row 4 Data Collumn 2 Row 4

I need to delete empty rows not programmatically. Is this possible? with empty paragraph clean option?

Hi Raul,

Thanks for your inquiry. Please note that MailMerge.CleanupOptions do not remove empty rows. You need to iterate through table’s row and remove the empty rows.

Moreover, I suggest you please read about new LINQ reporting engine from here:
https://docs.aspose.com/words/net/linq-reporting-engine/

Please also read about ‘Enumeration Extension Methods’ from here:
https://docs.aspose.com/words/net/appendix-a-enumeration-extension-methods/

Hope this helps you. Please let us know if you have any more queries.

Hi Tahir,

As I said, I can´t do anything programmatically, only from WORD. Do you think that this solution (more programmatically that Mail Merge) is good for me?

OK, if is impossible to delete rows, I could delete the carriage return from each table row in TableStart section? Using Text in stead of tables.

Thanks.

Hi Raul,

Thanks for your inquiry.

*raul.lopez.sanchez:

As I said, I can´t do anything programmatically, only from WORD. Do you think that this solution (more programmatically that Mail Merge) is good for me?*

If you want to remove empty rows of table, you can easily achieve this by iterating through table’s rows and remove the empty row. There should not be any issue with this use case. Could you please share the detail why you do not want to do this programmatically? We will then provide you more information on this.

*raul.lopez.sanchez:

OK, if is impossible to delete rows, I could delete the carriage return from each table row in TableStart section? Using Text in stead of tables.*

You can remove the table’s row using Row.Remove method. However, this option (remove empty row) is not available in MailMergeCleanupOptions. I have logged a new feature request for this use case as WORDSNET-12412 (MailMergeCleanupOption option to remove empty row). You will be notified via this forum thread once this feature is available. We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-12412) have been fixed in this Aspose.Words for .NET 17.3.0 update and this Aspose.Words for Java 17.3.0 update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.