Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Fri Nov 12, 2021 7:45 am

Hi,
I am using Free Spire.Doc for Java to iterate through a template multiple times, perform mail merge and save all the results in a document. The template is a table but I need each value set to populate in a new page as a new table instead of continuing from the last table. Could you please explain how to achieve this? I am currently using the following method for Mail Merge.
Code: Select all
MailMergeDataTable mm = new MailMergeDataTable("TableName", valueSetsList);
document.getMailMerge().executeGroup(mm);


But the result is one continuous table with all the valueSets for the merge fields without page break between each value set. How do I get each value set to populate in a new table in a new page?

Thank you!

chamaj95
 
Posts: 2
Joined: Tue Nov 02, 2021 10:50 am

Fri Nov 12, 2021 10:12 am

Hello,

Thank you for your inquiry.
Our Spire.DOC supports adding page breaks for Paragraph as shown the below code snippet.
Code: Select all
Paragraph paragraph = section.getParagraphs().get(3);
paragraph.appendBreak(BreakType.Page_Break);

You can share us with your template Word file, current full testing code as well as your desired output effect? Then we can provide you with a complete demo. Don’t worry, we will absolutely keep your documents confidential and won’t use them for other purpose. You could attach them here or send us via email (support@e-iceblue.com). Thanks in advance.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1643
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.Doc

cron