Keep with Next when using MailMerge.ExecuteWithRegions(ds)

We are generating a DOC exam which is consisted of several two columned-pages (as it shows the file attached here).

The questions starts in the top of the first (left) column of the first page and it flows to the top of the second column (right) of the page before breaking to another page.

There’s two kind of templates:

  1. The first one is only text:
    Screen Shot 2019-05-16 at 3.44.20 PM.png (44.5 KB)

  2. The second one consists of two tables, nested, with a bigger one envolving the whole question and the second one with the answer (which is misspeled) and the description.
    Screen Shot 2019-05-16 at 3.43.30 PM.png (49.6 KB)

If I choose the first template, the question flows exactly as we planned from one column to the other, with only one problem: if the last question of the page (usually on the second column) reach the bottom, it breaks in the middle of the text, resulting on poor visualization to the student.

If I choose the second template, it doesn’t break to the next page, in the middle of a question, which is good, but the content of a question doesn’t flow from on column to the other and, if it reaches the bottom, the table hides the rest of the content.

What we would like to do:

The content flow from on column to the other and when it reaches the bottom, the whole question is moved to the next page, leaving a blank space on its previous place.

We are using the MailMerge class. I’m attaching the templates, the results of both templates and the c#.net code.

Thanks in advance.

@jonroosevelt

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output Word file that shows the undesired behavior.
  • Please attach the expected output Word file that shows the desired behavior.
  • Please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.

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

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

Archive.zip (55.5 KB)
There you go

@jonroosevelt

Thanks for sharing the detail. We suggest you please set the ‘Keep with next’ property of following paragraph in your template document. Hope this helps you.

«Position»«Statement»

If you still face problem, please share the source code without compilation errors to reproduce this issue at our end. Unfortunately, we faced the compile time errors with your code.

@jonroosevelt

Further to my previous post, please note that Aspose.Words mimics the behavior of MS Word. If you perform the same scenario using MS Word, you will get the same output. We suggest you please read the following article.
Keeping Tables and Rows from Breaking across Pages