Notes on table layout

Grouping a bunch of cells into rows

It is possible to put table-cell elements as direct children of a table-body. In this case the table-body|header|footer FO builds table-row FOs from its table-cell FOs when it ends (in the FO tree building stage). This way the layout manager doesn't have to deal with the difference. It can always work on table-row objects.

Notes on the separate border model

In the separate border model the individual cell borders don't interact with their neighbours which makes it relatively easy to layout. For a page or column you'd simply take the table-header (if any), then add calculate the BPD of the table-footer (if any). The remaining available BPD is filled with table-rows as possible. Backtracking may be necessary to create an optimal layout.

Notes on the collapsing border model

In the collapsing border model the individual cell interact with neighbours. There are several factors influencing the height of a row (* marks the items that also apply to the separate border model):

  • the content of each cell (*)
  • the explicit BPD specified on cells and/or rows (*)
  • the resolved border width (see note below)

Note: Depending on the chosen break position the border width for the after edge of the cells (or rather grid units) in the last row before a table-footer may be different than without the table-footer present (the before edge of the table-footer has an influence). It also depends on whether a row is the last row or not (the after edge of the table and body have an influence). The border resolution can still be made at the FO tree building stage, but a grid unit must hold 3 possible values for its before and after border:

  • one for the normal case (table unbroken);
  • one for when it starts/ends a page (the table is broken just before/after its containing row); then the resolution must not include the preceding/following row, but must be made against the header/footer if any.
  • one for the case where the break occurs inside the row; then the resolution is the same as in the previous point, plus the border conditionalities must be taken into account.

Notes on column spanning

Column spanning is relatively easy. Each row manages a list of all grid units and their content. (See also o.a.f.fo.flow.table.FixedColRowGroupBuilder)

Illustrations

Here's a graphic that should help determine how to create BreakPoss instances on tables:

http://people.apache.org/~jeremias/fop/table-break-poss-examples.png

  • No labels