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
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
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
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
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!