(preventive disclosure: I'm a FOP developer, albeit not very active nowadays)
I think your approach #1 (i.e. using number-rows-spanned
) is the correct one, as it provides the most portable solution across different formatters.
Anyway, if you want to go with a "simpler" trick you could use a negative space-before
in the special yellow blocks:
<fo:table width="100%" table-layout="fixed">
<fo:table-column column-width="50%"/>
<fo:table-column column-width="50%"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell border="1pt solid #000000"><fo:block>orange 1</fo:block></fo:table-cell>
<fo:table-cell border="1pt solid #000000"><fo:block></fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell border="1pt solid #000000"><fo:block>orange 2</fo:block></fo:table-cell>
<fo:table-cell border="1pt solid #000000"><fo:block></fo:block></fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell border="1pt solid #000000"><fo:block>orange 3</fo:block></fo:table-cell>
<fo:table-cell border="1pt solid #000000">
<fo:block space-before="-12.8pt" space-before.conditionality="retain" background-color="yellow" padding-top="4pt" padding-bottom="4pt" font-size="16pt">Thanks</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
- the negative
space-before
must be the difference between the height of a normal block and the height of the special one (it's easier if all lengths are expressed in points, as I did in the example): in this case (12 * 1.2) - (16 * 1.2 + 4 + 4) = -12.8
space-before.conditionality="retain"
is needed to avoid the space to be discarded (as it is at the beginning of a cell)
- this dirty trick only works correctly if both the normal and the special blocks produce a single line of text
- tested with FOP 1.1 and FOP trunk
In conclusion you may be able to avoid using row-spanning cells, but it is not going to be much simpler, and it is surely a less general solution.