Dotx mail merge grid alignment bug


Currently we are using Aspose Words v21.9 (Java). Tried with v22.12, but the pdf output is wrong with it.
The break happened with version 22.2. With v22.1 the pdf looks the same as with v21.9.

Attached the test program code + dotx to reproduce the issue. The zip also contains some pdf output with different Aspose versions.

Thank You! (320.4 KB)

@EPluribusUnum The problem is causes by MailMergeCleanupOptions.REMOVE_EMPTY_PARAGRAPHS When you use this option, a paragraph that contains TableEnd:PU_BIZ is removed. This paragraph is a delimiter between two tables and when it is removed the tables are merged, this is by design because there must be a paragraph between tables in MS Word document. If there is no paragraph between the tables, they are concatenated. This leads to the incorrect table layout in your case.

Thank you @alexey.noskov , removing the REMOVE_EMPTY_PARAGRAPHS was the solution.

1 Like

@alexey.noskov, unfortunately removing the REMOVE_EMPTY_PARAGRAPHS cause error for other templates. See attached zip. (27.8 KB)

Error message :
“java.lang.IllegalStateException: Mail merge regions ‘TETELEK’ and ‘ESEDEK’ overlap. Two regions cannot start/end in the same paragraph or occupy the same table row.”

It this an aspose bug, or this is expected behaviour? What should I modify in the dotx template to avoid the error?

@EPluribusUnum In the attached template TableEnd of one region is in the same paragraph as TableStart of another region. Please see the screenshot:

As you can see there are soft line breaks between TETELEK table end and ESEDEK table start, so literally these fields are in the same paragraph. You should simply use normal paragraph break instead of soft line break between them.
The same situation is with other TableStart/TableEnd mergefields in your template.

@alexey.noskov, switching to PARAGRAPH_BREAK from LINE_BREAK worked. Thank you!

1 Like