Free Support Forum - aspose.com

The mail merge engine processed two similiar documents differently

For doc1, after document.MailMerge.Execute(datasource), it merged the first 4 fields, then it calls TableName(), since the first four fields are not table, so TableName is empty, then it throws an exception.


For doc2, after document.MailMerge.Execute(datasource), it merged the first 4 fields, then I can call document.MailMerge.ExecuteWithRegions(childDataSource);

Could you help me what the difference is between doc1 and doc2, I think they are the same.

Both docs have been modified before merging to avoid Aspose does not allow dot in field name.

Thanks for your help

Hi Caifang,

Thanks for your inquiry. In case you are using an older version of Aspose.Words, I would suggest you please upgrade to the latest version (v15.4.0) from here and let us know how it goes on your side. If the problem still remains, please share a standalone/runnable simple application (for example a Console Application Project) that demonstrates the code you used to reproduce this issue at our end. I will investigate the issue on my side and provide you more information.

Tried the new version, still the same error.

Hi Caifang,

Thanks for your inquiry. Please share a standalone/runnable simple application (for example a Console Application Project)
that demonstrates the code you used to reproduce this issue at our end.


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

Here is the demo application and the merge template (doc1 and doc2), doc1 and doc2 looks like the same, however, when doing the merge, doc1 failed and doc2 succeeded.


Doc1 and doc2 are located at the demo’s bin directory.

Hi Caifang,

Thanks for sharing the detail. The fields TableStart:TableName and TableEnd:TableName are not mail merge fields. The fields syntax is { TableStart:Field2 } and { TableEnd:Field2 } in your document. However, it should be { MERGEFIELD TableStart:Field2 } and { MERGEFIELD TableEnd:Field2 }. The MERGEFIELD is missing.

Please check the attached image for detail. I have attached the modified document with this post for your kind reference.

Thanks for your help. Looks like during the renaming field name process, MERGEFIELD is gone.


Our customers have used Aspose for long time, before Aspose started not allowing use dot in the field name, so we have to rename the field name before we can do the merge, we used the following link to rename the field name: http://www.aspose.com/docs/display/wordsnet/How+to++Rename+Merge+Fields

I attached the demo application to rename the field names. Could you help us where went wrong?

Thanks.

Hi Caifang,

Thanks for your patience. The code example in following documentation link has been updated. Please check it.
http://www.aspose.com/docs/display/wordsnet/How+to++Rename+Merge+Fields

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