[xsl] XSL-FO: Centering text vertically in a table column

Subject: [xsl] XSL-FO: Centering text vertically in a table column
From: "Chris Graham [WarpSpeed]" <chrisg@xxxxxxxxxxxxxxxx>
Date: Tue, 06 Feb 2007 21:02:33 +1100 (EDT)
Hello all.

Just how does one do it?

Here is the sample family tree table:

                        <fo:table table-layout="fixed" border-style="solid">
                            <fo:table-column column-width="3cm" />
                            <fo:table-column column-width="3cm" />
                            <fo:table-column column-width="3cm" />
                            <fo:table-body>
                                <fo:table-row>
                                    <fo:table-cell number-rows-spanned="4" border="1pt solid blue">
                                        <fo:block>PD</fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell number-rows-spanned="2" border="1pt solid blue">
                                        <fo:block>PDD</fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell number-rows-spanned="1" border="1pt solid blue">
                                        <fo:block>PDDD</fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                                <fo:table-row>
                                    <fo:table-cell number-rows-spanned="1" border="1pt solid pink">
                                        <fo:block>PDDB</fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                                <fo:table-row>
                                    <fo:table-cell number-rows-spanned="2" border="1pt solid pink">
                                        <fo:block>PDB</fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell number-rows-spanned="1" border="1pt solid blue">
                                        <fo:block>PDBD</fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                                <fo:table-row>
                                    <fo:table-cell number-rows-spanned="1" border="1pt solid pink">
                                        <fo:block>PDBB</fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                                <fo:table-row>
                                    <fo:table-cell number-rows-spanned="4" border="1pt solid pink">
                                        <fo:block>PB</fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell number-rows-spanned="2" border="1pt solid blue">
                                        <fo:block>PBD</fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell number-rows-spanned="1" border="1pt solid blue">
                                        <fo:block>PBDD</fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                                <fo:table-row>
                                    <fo:table-cell number-rows-spanned="1" border="1pt solid pink">
                                        <fo:block>PBDB</fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                                <fo:table-row>
                                    <fo:table-cell number-rows-spanned="2" border="1pt solid pink">
                                        <fo:block>PBB</fo:block>
                                    </fo:table-cell>
                                    <fo:table-cell number-rows-spanned="1" border="1pt solid blue">
                                        <fo:block>PBBD</fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                                <fo:table-row>
                                    <fo:table-cell number-rows-spanned="1" border="1pt solid pink">
                                        <fo:block>PBBB</fo:block>
                                    </fo:table-cell>
                                </fo:table-row>
                            </fo:table-body>
                        </fo:table>

This is what I get:

PD	PDD	PDDD
		PDDB
	PDB	PDBD
		PDBB
PB	PBD	PBDD
		PBDB
	PBB	PBBD
		PBBB

But, this is what I need:

	PDD	PDDD
PD		PDDB
	PDB	PDBD
		PDBB
	PBD	PBDD
PB		PBDB
	PBB	PBBD
		PBBB

The PD, and PB are centered within their column. (As should PDD, PDB, PBD and PBB, the Pxxx's should also be centered within their cell as well.

This is using Apache FOP.

-Chris

-Chris

WarpSpeed Computers - The Graham Utilities for OS/2.
Voice:  +61-3-9395-1504   Internet:   chrisg@xxxxxxxxxxxxxxxx
FAX:    +61-3-9395-7633   Web Page:   http://www.warpspeed.com.au
Postal: WarpSpeed Computers, PO Box 4293, Hoppers Crossing DC, VIC 3029, AUSTRALIA

Current Thread