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

Free Support Forum - aspose.com

ExecuteWithRegions inserts 2nd record in incorrect place

Hi Aspose Team,

please find the attached code and expected document.
MailMergeRegionsPositionError2.zip (777.4 KB)

We are trying to merge record set with two records, both being RTF fields. We have our implementation of IFieldMergingCallback to insert HTML at the place of mergefield. The problem seems to be that the 2nd time we enter the callback mergefield is in incorrect place (at the end of 1st paragraph, so basically in the middle of text merged for first record).

Could you please take a look and explain why this is happening? Is there anything we can do to correct this on our side?



I am afraid, the Visual Studio code project that you attached is quite complex. We request you to please simplify this code and attach a minimal new project that still reproduces the same problem with 19.3 version of Aspose.Words for .NET.

Also, please ZIP and attach Aspose.Words 19.3 generated output DOCX file showing the undesired behavior here for further testing.

Thanks for your cooperation.

Hi Awais,

I’ve simplified the code as much as possible. Sorry, but to replicate the issue our implementation of some of your interfaces is required, hence the code complexity. Expected output and generated one for comparison are also attached in zip file.

aspose_MailMergeRegionPositionSimpler2.zip (5.6 MB)



You can simply remove the following line to fix this issue:

document.MailMerge.UseWholeParagraphAsRegion = false;