This is a migrated thread and some comments may be shown as answers.

Prevent table from having contents broken across pages

5 Answers 64 Views
RichTextEditor
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 05 Jun 2018, 07:55 PM

Hello,

I am experimenting with programmatically creating RadDocuments, and am creating a table in the document where I am adding cells that contain a barcode and also some text. However, sometimes the text is broken off from its barcode and placed on another page, which I do not want. Since I am new at this RadDocument thing, I would like to know what I need to do to get the cell contents to stay together. See attached image.

Thanks,

Matt

5 Answers, 1 is accepted

Sort by
0
Matt
Top achievements
Rank 1
answered on 07 Jun 2018, 01:18 PM
Anyone have input on this?
0
Tanya
Telerik team
answered on 07 Jun 2018, 01:25 PM
Hi Matt,

This is a setting of the table rows that prevents splitting their content into different pages. This option, however, is not supported in RadDocument and we have it logged as a feature request on our public portal. Please, make sure to cast your vote for the implementation and subscribe to the public item so you can receive notifications about status changes on it. I have also updated your Telerik points for the report. Additionally, you can subscribe to the issue and be updated when its status changes.

Regards,
Tanya
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Matt
Top achievements
Rank 1
answered on 07 Jun 2018, 01:37 PM

I have voted this feature up, however this is still a problem for me at this moment. I will do some creative thinking to figure out a solution in the meantime. Since I control what is being printed (for the most part), I should be able to come up with a solution. Thanks for the response.

 

Matt

0
Boby
Telerik team
answered on 08 Jun 2018, 02:56 PM
Hello Matt,

As a workaround you can, for example, examine the number of TableRowLayoutBoxes associated with the table row after each insert - if the table row has more than one TableRowLayoutBoxes, it's split to two pages, so you could undo last insertion, start new page by inserting a page break before after the table and starting new table:
this.radRichTextBox.BeginUndoGroup();
this.radRichTextBox.InsertTableRowBelow();
this.radRichTextBox.Insert("some text");
this.radRichTextBox.InsertImage(barcodeStream, "png");
this.radRichTextBox.EndUndoGroup();
 
var lastTableRow = this.radRichTextBox.Document.EnumerateChildrenOfType<Table>().Last().EnumerateChildrenOfType<TableRow>().Last();
if (lastTableRow.FirstLayoutBox != lastTableRow.LastLayoutBox)
{
    this.radRichTextBox.Undo();
    this.radRichTextBox.InsertPageBreak();
    // Start new table and add the same content again.
}

If the creation of the document is in the code behind and you don't have RadRichTextEditor instance, you can use RadDocumentEditor instead (it has the same API as RadRichTextEditor). Note that this could be slow, as it involves updating the layout of the entire document for each row insert.

Regards,
Boby
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Matt
Top achievements
Rank 1
answered on 11 Jun 2018, 01:58 PM

Thanks for the input. In the meantime, I created a composite bitmap that contains my barcode and my description and then just inserted that into each cell. I will try your code later when I have some free time.

Thanks!

Tags
RichTextEditor
Asked by
Matt
Top achievements
Rank 1
Answers by
Matt
Top achievements
Rank 1
Tanya
Telerik team
Boby
Telerik team
Share this question
or