Keep together Tabel in RadDocument

1 Answer 50 Views
GridView
Guarana91
Top achievements
Rank 1
Iron
Iron
Guarana91 asked on 26 Oct 2023, 06:21 AM

Hello everyone,

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

Sort by
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:

RichTextBox: Add Line and Page Break properties of Paragraph (telerik.com)

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.

Regards,
Stenly
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Guarana91
Top achievements
Rank 1
Iron
Iron
commented on 01 Nov 2023, 09:46 AM

Thanks :-)

I wil try this solution.

Tags
GridView
Asked by
Guarana91
Top achievements
Rank 1
Iron
Iron
Answers by
Stenly
Telerik team
Share this question
or