Free Support Forum - aspose.com

Unexpected Mail merge region is badly formed error

When trying to do a mail merge on the attached template we get the following error:
Quote Summary Template is throwing error: Mail merge region ‘HasQuoteCharges’ is badly formed. TableStart and TableEnd should be in the same section, same table row or same table cell

When I review the Word Document, showing sections, it appears to be correct. Please advise.

Also, are these type of error written to the response body? We would like to add them to our logger. Today I have to login to Saaspose to determine an error.

Hi Gloria,

Can you please also share your XML? Providing expected output document would be even better.

Best Regards,
Muhammad Ijaz
Support Developer, Saaspose Sialkot Team
http://www.saaspose.com

It is a parsing error. You should not need the XML to reproduce. In this case the Has tag is not in the XML. The result is to hide the charges section when there is not any charges data.

Here is the XML:

Acclivity Value 1200
1
$499.00
$499.00
$499.00
$83.44
$83.44
$83.44
$582.44
$582.44
$582.44
00a00000piscd0ki


MyFee1
amount
5.1507
$30.00


MyDiscount1
amount
1.7169
($10.00)

Hi Gloria,

Thanks for the XML. You are right, it is a parsing error, but we needed this XML to execute mail merge and make sure no other exception stops the process. I am analyzing your template and let you know once it is done.

Best Regards,
Muhammad Ijaz
Support Developer, Saaspose Sialkot Team
http://www.saaspose.com

Okay, also please consider better error messaging. Keep in mind we have a multi-user system, used by multi-implementations. For us to report errors the user has made is important. Perhaps there needs to be another URI request to get the history. This is not an immediate need.

Hi Gloria,

Regarding error messaging, Saaspose service returns proper error messages in response but the problem seems to be with error handling in .NET and Java SDKs; there is no such issue with other SDKs. We will check this issue and let you know once it is resolved.

Best Regards,
Muhammad Ijaz
Support Developer, Saaspose Sialkot Team
http://www.saaspose.com

Hi Gloria,

If you select 'Charges' table, you will notice that "TableStart:HasQuoteCharges" field is inside the table and "TableEnd:HasQuoteCharges" field is outside the table which is not allowed and raises this exception. I have updated your document and placed "TableStart:HasQuoteCharges" outside the table (just before the start of Charges table) and now I can execute mail merge without any exception.

Updated document is attached; please use it and let us know if it works for you.

Best Regards,
Muhammad Ijaz
Support Developer, Saaspose Sialkot Team
http://www.saaspose.com

I keep running into this error. I did get the Charges table working, but I need to do the same type of thing around the Discounts Table that is below the Charges. I don't see that the TableStart:/TableEnd:HasQuoteDiscounts tags are in the table. Can you please review attached file and advice? Is there a way I easily view the table borders in Word?

Hi Gloria,

I was not able to find any problem with TableStart:/TableEnd:HasQuoteDiscounts tags but when I use these tags, I keep getting this exception. Surprisingly, when I copy these tags from another document, I do not get this exception.

The best solution I can suggest is remove TableStart:/TableEnd:HasQuoteDiscounts tags from your document, rename TableStart:/TableEnd: tags in the attached TableRegion.doc document and copy/paste in your document, then cut/paste (place) Discounts table or any other table between these tags. I hope this trick works for you.

Best Regards,
Muhammad Ijaz
Support Developer, Saaspose Sialkot Team
http://www.saaspose.com

Sorry, attachment was missed.

Best Regards,
Muhammad Ijaz
Support Developer, Saaspose Sialkot Team
http://www.saaspose.com

Hi Gloria,

Is this issue resolved at your end? Did the last suggestion from our team help in this scenario. Please do let us know if you need any further assistance.

Thanks & Regards
Shahzad Latif
Saaspose Support Team.