Mailmerge replacing existing script

We had a js script that we were doing mail merge with, there are two sections that I had questions about.

1. Some of the templates had a special flag. I believe this was required by certain templates to avoid an additional page break at the end of the document. I don’t see an equivalent in aspose word.
if (_mailmergetype == “catalog”) {
wordDocument.MailMerge.MainDocumentType = /* wdCatalog */ 3;
}

2. There is preprocessing and post processing that is summed up in this comment:
// Microsoft Word has a bug where it deletes Text Form Fields from a document
// during a Mail Merge operation. There is a workaround documented at
// Microsoft Support that is
// adapted here. Basically, the workaround is to replace the text form fields
// ourselves with named plain text placeholders. After the merge we replace the
// named placeholders with the text form fields, effectively preserving the
// them across a mail merge operation.




Hi Alfred,


Thanks for your inquiry.

1- Please use the following statement:
doc.getMailMergeSettings().setMainDocumentType(MailMergeMainDocumentType.CATALOG);
2- Please upgrade to the latest version of Aspose.Words for Java 15.10.0 and see how it goes on your end. I hope, this helps. In case the problem still remains, please attach the following resources here for testing:

  • Your input Word document
  • Aspose.Words generated output document (.docx file) which shows the incorrect behavior
  • Your expected document which shows the correct output. You can create expected document using Microsoft Word.
  • Please create a standalone runnable simple Java application (source code without compilation errors) that helps us reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip them and Click ‘Reply’ button that will bring you to the ‘reply page’ and there at the bottom you can include any attachments with that post by clicking the ‘Add/Update’ button.

Best regards,

Thanks, for the response. Sorry I didn’t dig deep enough.
I will have to resurrect the 2nd issue’s template and csv. But I suspect that this is Microsoft specific.