I would like to generate a table like the one in the image below using FOP:
- Left column can have 1 or any number of rows.
- Block1 and Block2 in right column can have 1 or any number of lines. I want Block1 to be top aligned and Block2 to be bottom aligned.
For the right column I tried this:
<fo:table-cell number-rows-spanned="$rows-spanned" display-align="after">
<fo:block>
Block1 Lorem ipsum
</fo:block>
<fo:block>
Block2 Lorem ipsum bla aaaa
</fo:block>
</fo:table-cell>
but it aligns Block1 and Block2 to the bottom.
Any idea how to achieve the desired output?
(disclosure: I'm a FOP developer, though not very active nowadays)
After some pondering, I've thought of two possible solutions.
Solution 1 (recommended): using two spanning cells
Instead of spanning all the rows with a single cell containing both blocks, span just half the rows with a cell containing Block 1, and then use another row-spanning cell with
display-align="after"
for Block 2:Pros:
Cons:
Solution 2: using an extra column and margin tricks
You can define the table to have 3 columns, put Block 1 in a cell spanning all rows in column #2 and Block 2 spanning all rows in column #3, and creatively use margins to "move" Block 2 in the desired location:
Pro:
Cons:
INFO
message about the table being larger than the available space)