Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

Knuth Element Evaluation for page breaking

Table with headers and footers

The XSL-FO snippet

No Format
<fo:table border="solid 2pt red">
  <fo:table-header>
    <fo:table-row border="solid 4pt blue">
      <fo:table-cell>
        <fo:block>header</fo:block>
      </fo:table-cell>
    </fo:table-row>
  </fo:table-header>
  <fo:table-footer>
    <fo:table-row border="solid 4pt green">
      <fo:table-cell>
        <fo:block>footer</fo:block>
      </fo:table-cell>
    </fo:table-row>
  </fo:table-footer>
  <fo:table-body>
    <fo:table-row border="solid 1pt orange">
      <fo:table-cell>
        <fo:block>cell1</fo:block>
      </fo:table-cell>
      <fo:table-cell>
        <fo:block>cell2</fo:block>
      </fo:table-cell>
    </fo:table-row>
    <fo:table-row border="solid 1pt orange">
      <fo:table-cell>
        <fo:block>cell3a</fo:block>
        <fo:block>cell3b</fo:block>
      </fo:table-cell>
      <fo:table-cell>
        <fo:block>cell4a</fo:block>
        <fo:block>cell4b</fo:block>
      </fo:table-cell>
    </fo:table-row>
  </fo:table-body>
</fo:table>

the three possibilities

http://people.apache.org/~jeremias/fop/KnuthElementsForTables.gif

the result

  • box(header's half border-before, w=2pt)
  • box(header, w=14.4pt)
  • box(border between header and row1, w=4pt)
  • box(row1, w=14.4pt)
  • Wiki Markup
    penalty(p=0, w=4pt+14.4pt+4pt=height of footer + border between row1 and footer + border-after of footer) \[1\]

  • Wiki Markup
    glue(border between row1 and row2, w=1pt, y=z=0) \[2\]
    \\

  • box(row2 first line, w=14.4pt)
  • Wiki Markup
    penalty(p=0, w=4pt+14.4pt+4pt=height of footer + border between row2 first line and footer + border-after of footer) \[3\]
    \\

  • box(row2 second line, w=14.4pt)
  • box(border between row2 and footer, w=4pt)
  • box(footer, w=14.4pt)
  • box(footers's half border-after, w=2pt)

After a page break cause by a special penalty, the elements for the table-header must be added as first elements on the new page. The elements for the next page must be recalculated anyway (because of potentially different available IPD). Unused elements after the breaking element must be discarded.

(Note: The above is under the assumption that a non-look-ahead page breaking algorithm is implemented.)

Wiki Markup
\[1\] First break possibility

Wiki Markup
\[2\] This is no BP since the glue is not following a box.

Wiki Markup
\[3\] Second break possibility