Inserting Page Break before table and Table over multi pages

Hi, I’ve got a document template that contains a group of tables on one page to start with.
What I’m doing is inserting rows dynamically based on a given number of records for each of the tables.
So I’ve got a TableCollection and referencing each table by it’s integer reference in the collection. e.g.

Aspose.Words.Document template = new Aspose.Words.Document(templateName);
Aspose.Words.Tables.TableCollection clearanceCertTables = template.Sections[0].Body.Tables;
DoStuffWithTable(clearanceCertTables[i]);

Now, if one of the tables ends up being split over two pages which is very likely, I’d like to be able to force that table to start on a new page.
So I think the two things I need to know are

  1. If I have a table, how can I figure out that it’s split over multiple pages.
  2. If it is over multiple pages, how do I go about inserting a page break before the table. (I would guess find the table, get it’s parent and insert the page break that way)

Thanks for your help. If you need more info, please contact me.
Nolan

Hi

Thanks for your request. I think in your case, you can just use KeepWithNext option. Please see the following link for more information:
https://forum.aspose.com/t/79650
Hope this helps.
Best regards.

Hi, thanks for your reply.

Given this information, how would I go about applying it to a document template where I want the 3rd table out of 5 to be the one that only sits on the one page where it doesn’t matter if the other tables span over a page.

I haven’t at this stage found how I can navigate the tables in the document using the document builder to be able to specifically reference the table I’d like to apply the value KeepWithNext = true;

Thanks for your help.

Nolan

Hi

Thank you for additional information. But it is no quite clear for me what the problem is. Please attach your template, output and expected output documents. I will check them and provide you more information.
Best regards.