Forum How do I...?

Understanding and manipulating the logic of breaking tables between pages?

melusina
I have to deal with a publication that has an incredibly great number of sometimes very long tables. In general Prince breaks tables across pages in case it is necessary and that's great. In some cases, however, it does not although it would be possible, leaving one page with a huge empty area. When, due to the huge number of tables in the publication, this happens frequently, the overall publication tends to make a slightly chaotic/uneasy impression.

Thus, I think my actual question is, why are tables sometimes not broken apart although they could and it would make a better impression. One example, in which the upper part of the table would partially fit on the preceding page:

table_break_pdf.png


HTML:

<div class="table">
               <table class="rules" style="border-collapse:collapse;border-spacing:0;">
                  <tbody><tr>
                     <td class="Melusina_Table_Header">Nationalität</td>
                     <td class="Melusina_Table_Header">Anzahl Einwohner</td>
                  </tr>
                  <tr>
                     <td class="Melusina_Table_Index">Luxemburger</td>
                     <td class="left">304&nbsp;300</td>
                  </tr>
                  <tr>
                     <td class="Melusina_Table_Index">Ausländer (total)</td>
                     <td class="left">258&nbsp;700</td>
                  </tr>
                  <tr>
                     <td class="Melusina_Table_Index">...Portugal</td>
                     <td class="left">92&nbsp;100</td>
                  </tr>
                  <tr>
                     <td class="Melusina_Table_Index">...Frankreich</td>
                     <td class="left">39&nbsp;400</td>
                  </tr>
                  <tr>
                     <td class="Melusina_Table_Index">...Italien</td>
                     <td class="left">19&nbsp;500</td>
                  </tr>
                  <tr>
                     <td class="Melusina_Table_Index">...Belgien</td>
                     <td class="left">18&nbsp;800</td>
                  </tr>
                  <tr>
                     <td class="Melusina_Table_Index">...Deutschland</td>
                     <td class="left">12&nbsp;800</td>
                  </tr>
                  <tr>
                     <td class="Melusina_Table_Index">...Großbritannien</td>
                     <td class="left">6&nbsp;000</td>
                  </tr>
                  <tr>
                     <td class="Melusina_Table_Index">...Niederlande</td>
                     <td class="left">4&nbsp;000</td>
                  </tr>
                  <tr>
                     <td class="Melusina_Table_Index">...Andere EU-Länder</td>
                     <td class="left">29&nbsp;600</td>
                  </tr>
                  <tr>
                     <td class="Melusina_Table_Index">...Andere Nicht-EU-Länder</td>
                     <td class="left">36 500</td>
                  </tr>
                  <tr>
                     <td class="Melusina_Table_Index">Gesamtbevölkerung</td>
                     <td class="left">563&nbsp;000</td>
                  </tr>
                  </tbody><caption align="bottom">Tabelle 1: Einwohnerzahlen Luxemburgs nach Nationalität (Stand 1.1.2015, <cite>vgl.</cite><cite>Statec 2015</cite>)</caption>
               </table>
            </div>


CSS related:

table {
    caption-side: bottom;
    margin-top: 18pt;
    font-size: 9pt;
    line-height: 1.2;
}

table caption {
    margin-top: 4pt;
    margin-bottom: 12pt;
    font-size: 9pt;
    line-height: 1.2;
    prince-caption-page: all;
}

td {
    text-align: left;
}

tr:first-of-type {
    page-break-after: avoid;
}

tr:last-of-type {
    page-break-before: avoid;
}

td.Melusina_Table_Header {
    border-bottom: 0;
    padding-bottom: 4pt;
    text-align: left;
    font-size: 9pt;
    text-transform: uppercase;
    font-weight: normal;
    vertical-align: bottom;
    hyphens: none;
}

td.Melusina_Table_Index {
    font-weight: normal;
}
  1. table_break_pdf.png481.8 kB
mikeday
Are there other style rules applying, for example the .rules class? When I try the example you have posted it seems to break fine.
melusina
No, the .rules class and the div.table class are empty. It is set by the converter we use to get from docx to html. I looked at it in the CSS and from the inspector and it defines nothing.