Prevent table from having contents broken across pages

6 posts, 0 answers
  1. Matt
    Matt avatar
    13 posts
    Member since:
    Mar 2018

    Posted 05 Jun Link to this post

    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

  2. Matt
    Matt avatar
    13 posts
    Member since:
    Mar 2018

    Posted 07 Jun in reply to Matt Link to this post

    Anyone have input on this?
  3. Tanya
    Admin
    Tanya avatar
    737 posts

    Posted 07 Jun Link to this post

    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.
  4. Matt
    Matt avatar
    13 posts
    Member since:
    Mar 2018

    Posted 07 Jun in reply to Tanya Link to this post

    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

  5. Boby
    Admin
    Boby avatar
    689 posts

    Posted 08 Jun Link to this post

    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.
  6. Matt
    Matt avatar
    13 posts
    Member since:
    Mar 2018

    Posted 11 Jun in reply to Boby Link to this post

    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!

Back to Top