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

Free Support Forum - aspose.com

How to control New Pages in Mail Merge template using Java

Problem:
A customer of ours has a two-sided template. After the mail merge, the 2nd data record begins on the last page of the 1st data record.
In MS Word there is a section change (next page). This is missing in the document created with Aspose.

Here is a sample program with the problem template:
Aspose.Word.Testanwendung.zip (67.4 KB)

And here is the output comparison MS Word - Aspose.Word:
Output comparison.zip (163.1 KB)

@Niebelschutz

Please read the following article to achieve your requirement.
Controlling New Pages when Using Simple Mail Merge

Please open your document and set the section start as shown in attached image. We have attached the modified template document with this post for your kind reference.
new page.png (35.1 KB)
Template2.zip (62.7 KB)

Thank you for the information. I tried the setting. The 2nd record now starts on a new page.

Is there a setting in Aspose that automatically takes over the behavior? In MS Word, a section change (new page) is automatically inserted between the data records, which is also logical for me, because a new data record starts.
Our customers have been working with MS Word for years and sometimes have 100s of templates that they are reluctant to customize.

@Niebelschutz

You can use Section.PageSetup.SectionStart property to set the type of section break for the specified object. Please check the following code snippet.

Document doc = new Document(MyDir + "input.docx");
doc.Sections[0].PageSetup.SectionStart = SectionStart.NewPage;

Thank you for the information. I have set the option.
When using customer templates on a random basis, the result now appears to be the same as in MS Word.

@Niebelschutz

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