orbeon / orbeon-forms

Orbeon Forms is an open source web forms solution. It includes an XForms engine, the Form Builder web-based form editor, and the Form Runner runtime.
http://www.orbeon.com/
GNU Lesser General Public License v2.1
511 stars 220 forks source link

Overlap of some fields in PDF #6367

Closed ebruchez closed 3 weeks ago

ebruchez commented 3 weeks ago

+1 from customer

ebruchez commented 3 weeks ago

The issue is that the first cell of the first grid of the first section has an h="2".

ebruchez commented 3 weeks ago

It's easy to add h="2": add grid row, expand cell down.

The HTML produced for the PDF renderer has a rowspan="2":


<table class="fr-grid fr-grid-1 fr-grid-grid-1 fr-norepeat" role="presentation">
    <tbody class="fr-grid-body">
        <tr class="fr-grid-tr">
            <td id="section-1-section≡grid-1-grid≡xf-772" class="fr-grid-td xforms-group" rowspan="2">
                CONTENT
            </td>
        </tr>
    </tbody>
</table>
<div class="fr-grid-non-empty" id="section-1-section≡grid-1-grid≡xf-781"/>
ebruchez commented 3 weeks ago

The grid model looks like this:

GridModel(
  List(
    List(Cell(Some(org.orbeon.saxon.tinytree.TinyElementImpl@22704002), None, 1, 1, 2, 1)),
    List(
      Cell(
        Some(org.orbeon.saxon.tinytree.TinyElementImpl@22704002),
        Some(Cell(Some(org.orbeon.saxon.tinytree.TinyElementImpl@22704002), None, 1, 1, 2, 12)),
        1,
        2,
        1,
        1
      )
    )
  )
)

But we only keep the Nones, so we get:

[
  (
    {
      "c": "org.orbeon.saxon.tinytree.TinyElementImpl@22704002",
      "x": 1,
      "y": 1,
      "h": 2,
      "w": 1
      }
    }
  ),
  ()
]
ebruchez commented 3 weeks ago

Since #5260, we don't output the <tr> if there are no cells in that row. This is why there is no second <tr>.

ebruchez commented 3 weeks ago

Interestingly, #5260 was about an error caused exactly in this scenario of a single cell spanning two rows. The solution chosen was to avoid trying to output the row <tr>, but this messes up the rowspans. So it's better to output the <tr> but not output any <td> if none needed.