Keep table together if less than 1 page

I’m using Aspose.words to compose and inject data into a pretty complicated Word doc. It is working quite nicely - the only issue I am having is that some tables are being rendered with the header row at the bottom of one page and then the rest of the table on the next page. I have attached an example doc which at the bottom of page 4 illustrates this issue. What I would like is to have the table that has it’s header row only at the bottom of page 4 to actually start on page 5 and have nothing at the bottom of page 4.
I have tried setting everything such as Keep Lines together, Keep with next, etc but I can’t seem to get the table to stay together on one page.
So, I have 2 questions - first, is what I am trying to do even possible and second, if it is possible how would I do it using Word and Aspose?


Thanks for your request. Yes, of course this is possible. To achieve this, you should set “Keep With Next” option for each paragraph in the table. In your case, this did not work because you set this option for all paragraphs in the document. So, if you reset this option where it is not necessary, all will works as expected.
Best regards.

Hi Alexey,
Thanks so much for the reply - I am dynamically injecting content into the doc and hadn’t realized that the result was the entire doc was set as Keep With Next. Your help is truly appreciated!