I have a table in my RadDocument. I create the tabele with code and insert it at the end in my RadDocument.
Is there a way to keep the whole table together if the table reach a page break?
Best regards and thanks for your help :-)
1 Answer, 1 is accepted
0
Stenly
Telerik team
answered on 30 Oct 2023, 02:39 PM
Hello Guarana91,
The way to achieve this in MS Word is by setting Keep With Next to all paragraphs within the table. This property is currently not supported by RadRichTextBox. You can subscribe and vote for the feature request using the item in our public portal here:
As the behavior should be included deep in the core layout of the control and is pretty complex, there is no generic workaround available with the public API. You can manually insert page breaks in the document, though. For example, you can examine the number of TableLayoutBoxes associated with the table after each insert - if the table has more than one TableLayoutBox, it's split into two pages, so you could insert a page break before it:
var lastTable = this.radRichTextBox.Document.EnumerateChildrenOfType<Table>().Last();
if (lastTable.FirstLayoutBox != lastTable.LastLayoutBox)
{
// insert a page break and proceed to the next table.
}
I hope the provided information will be of help to you.