Skip to main content
LMS_90
Inspiring
April 3, 2023
Question

RH 2022 (2022.1.188) PDF how prevent tables from breaking across pages?

  • April 3, 2023
  • 2 replies
  • 214 views

Using RH on windows 10 pc, version 2022.1.188.

 

Tables are breaking across pages and client doesn't want this. How do I fix it in the PDF output generation?

 

Thx

    This topic has been closed for replies.

    2 replies

    Community Expert
    April 4, 2023

    I assume you manually added the '<table>' entry just now? If so, it won't work as the syntax is wrong for css, so you should delete it and we'll start again.

     

    When creating a style for an html tag without a class (i.e. will apply to every instance of a specific tag), only the text inside the angle brackets is used. A class appended to the tag then allows you to apply specific formatting/properties to particular instances of that tag.

     

    If you want all tables to avoid breaking across pages, add a new style again, but in the Tag field select from the predefined list of elements, that ensures the correct tag name is used. Leave the other fields blank as we are setting this for all tables. After you click Done you'll see 'table' in your stylesheet, You can now set the break-inside value.

     

    I notice in your screenshot there are a couple of table styles defined (noindent-noheader for example), and if you only wanted the tables with that formatting changed you could make the change in that style instead of on the table tag itself. 

     

    Test a few different documents to make sure everything looks okay. 

    Community Expert
    April 4, 2023

    If tables are longer than the page, I believe they will always break across pages.

     

    For short tables, it might be possible to 'mostly' push them to a new page. I haven't played with the pdf output in New UI (I can't get it to work on 2 pcs across 3 version 🙂 ) but you could try adding 'break-inside: avoid;' to the table element in your PDF stylesheet and see if that works.

    LMS_90
    LMS_90Author
    Inspiring
    April 4, 2023

    Of course if a table is longer than a page it's going to break. I'm talking about tables that are shorter than a page.

     

    Where do I put break-inside: avoid? 

    Setting it in the table style in the css of the main project does nothing. 

     

    LMS_90
    LMS_90Author
    Inspiring
    April 4, 2023

    I put the code inline and it works:  <table class="noIndent" style="width: 100%;break-inside: avoid">

     

    However I should not have to do that..... setting it in the style should do this.