I’ve seen that there is a Property that can be used to specify that we don’t want a row to be diveded across pages.
Aspose.Words.Row asposeRow = new Aspose.Words.Row(wordContext.AsposeDocument);
asposeRow.RowFormat.AllowBreakAcrossPages = false;
Is there a similar property for the whole table? In other words, I want my table (consisting of 2/3 rows) not to be split, so it has to be generated at the end of a page only if all the rows can fit in the page; otherwise, it has to be created completely in the next page.
How can I do this ?
Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Thanks for your inquiry. I think that you can set KeepWithNext property to true for each paragraph inside table. See the following code:
Document doc = new Document(@"Test311\in.doc");
//Get table from document
Table tab = doc.FirstSection.Body.Tables;
//Get collection of paragraphs inside table
NodeCollection paragraphs = tab.GetChildNodes(NodeType.Paragraph, true);
//Loop through all paragraphs
foreach (Paragraph par in paragraphs)
//Set KeepWithNext property
par.ParagraphFormat.KeepWithNext = true;
Also see the attached documents.
Hope this helps.
Thank you very much for your help,