Page break after data change

I would like to split a list of data using the mail merge function.

Please see the below example of how I want to split the data:
Name Department
John HR
Peter HR
Jack HR
–Insert Page break here–
Sarah IT
Adam IT
–Insert Page break here–
Pete Admin
Susan Admin

The data is stored in a DataTable.

How do I do this.


Thanks for your inquiry. Please refer to the following article.
How to Control New Pages during Mail Merge

If you still face problem, please attach the following resources here for our reference. We will then provide you more information about your query. Thanks for your cooperation.

  • Your input Word document.
  • Please attach the expected output Word file that shows the desired behavior.

PS: To attach these resources, please zip and upload them.

Good Day

Here’s the template for the mail merge report I’m running. Custom Report data must break the page for every Department.

Here is the code I use:

DataView view = new DataView(dt);

string fileName = "LastClockTimeReport.docx";
string nowTime = DateTime.Now.ToShortTimeString();
string nowDate = DateTime.Now.ToShortDateString();

Document doc = new Document(fileName);

//Data for mail merge
String[] fieldNames = new String[] { "NowDate", "NowTime"};
Object[] fieldValues = new Object[] { nowDate, nowTime};

//Execute mail merge
doc.MailMerge.Execute(fieldNames, fieldValues);
doc.MailMerge.TrimWhitespaces = false;

doc.Save(@"Reports\Last_Clock_Per_Employee_Report.docx"); (26.8 KB)


Thanks for your inquiry. We suggest you please read following articles.
Mail Merge with Regions Explained
How to Execute Mail Merge with Regions

In your case, the datasource must have proper relationship between tables. You need to create separate table for departments. Please check the attached modified document. (13.0 KB)

I’m a little confused, can you perhaps explain how to implement the page breaks with regards to the template you amended. Could you provide sample code?


Thanks for your inquiry. Please check the mail merge examples from Github repository.

Please check the following code example and check the attached template. (47.1 KB)

// Create the Dataset and read the XML.
DataSet pizzaDs = new DataSet();

// Note: The Datatable.TableNames and the DataSet.Relations are defined implicitly by .NET through ReadXml.
// To see examples of how to set up relations manually check the corresponding documentation of this sample
pizzaDs.ReadXml(MyDir + "CustomerData.xml");

string fileName = "Invoice Template.doc";
// Open the template document.
Document doc = new Document(MyDir + fileName);

// Trim trailing and leading whitespaces mail merge values
doc.MailMerge.TrimWhitespaces = false;

// Execute the nested mail merge with regions

doc.Save(MyDir + "18.7.docx");

The “Page break before” property is set for the first paragraph of the document. This breaks the page after each record of order table. Hope this helps you.

How do I implement the additional table with departments so that list gets page break between departments?


Thanks for your inquiry. Please check the attached modified template document. (13.4 KB)

Could you please share some detail of your data source and tables structure? We will then provide you more information on it.