Hi
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.
In example:
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 ?
Thanks,
Gianni
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:
//Open document
Document doc = new Document(@"Test311\in.doc");
//Get table from document
Table tab = doc.FirstSection.Body.Tables[0];
//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;
}
//Save document
doc.Save(@"Test311\out.doc");
Also see the attached documents.
Hope this helps.
Best regards.
Thank you very much for your help,
Regards