Nowadays we can argue if using Apache FOP is still the best solution for generating PDF documents. One of it’s biggest competitors is probably JasperReports Library which supports multiple file formats and does not require creating XML templates manually from scratch (thanks to Jaspersoft Studio).
However, sometimes you just have to face the FOP’s XML monster :)
The FOP’s way of styling elements (text blocks, tables etc.) is almost identical to the CSS. But what if you want table cell content centered vertically? Probably you will try with something like (CSS way):
<fo:table-cell vertical-align="middle"> <fo:block>Hello FOP</fo:block> </fo:table-cell>
Unfortunately it has no effect at all. To center table cell content vertically we need to set
<fo:table-cell display-align="center"> <fo:block>Hello FOP</fo:block> </fo:table-cell>
This method is also applicable for top/bottom aligning - check this Stack Overflow question for details.