xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karl Roberts" <Karl.Robe...@macquarie.com>
Subject Howto align tables to fill width
Date Mon, 06 Mar 2006 23:28:05 GMT
Hi all,

I have some XML that defines TabularData elements, which represent
tabular data. In some cases the data can includes information on the
column widths in order to guarentee that the data fit's in it.


		<!-- mandatory fields from schema -->
		<TableTitle>Fresh Money IDEAs</TableTitle>
		<!-- optional fields from schema -->
<!-- nb the width should be calculated from fontmetrics, use (num of
chars * 0.6 for now) -->
		<Column num="1" width="7.8" text-justify="left"/>
		<Column num="2" width="2.6" text-justify="left"/>
		<Column num="3" width="3.6" text-justify="right"/>
		<Column num="4" width="4.2" text-justify="right"/>
		<Column num="5" width="2.4" text-justify="right"/>
	<Cell xpos="0" ypos="0">ColHeader1</Cell>
	<Cell xpos="1" ypos="0">CH2</Cell>
	<Cell xpos="2" ypos="0">Col3 Price</Cell>
	<Cell xpos="3" ypos="0">Header4</Cell>
	<Cell xpos="4" ypos="0">Head 5</Cell>
	<Cell xpos="0" ypos="1">Chartered Semiconductor</Cell>
	<Cell xpos="1" ypos="1">OP</Cell>
	<Cell xpos="2" ypos="1">1.5</Cell>
	<Cell xpos="3" ypos="1">1.29</Cell>
	<Cell xpos="4" ypos="1">16</Cell>

I have an xsl template that can turn all this into a nice table and if
the data contains <Column> elements I use xsl like this ...

<fo:table table-layout="fixed" width="100%">
<xsl:for-each select="MetaData/Column">
	<xsl:sort select="self::node()/@num" data-type="number"/>
	<fo:table-column column-number="{self::node()/@num}"
<fo:table-body> ... </fo:table-body>

I works fine. However when the table width is greater than the sum of
the widths I'd like to widen the columns (or just the first one) to fill
the available space. Given that the xsl to produce a table is in a call
and hence the table width is given as 100% (of space available to the
<fo:block/> that it is enclosed inanyone have a clue how to do this?

If it helps I'll post the schema and xsl-fo template for the table.



This e-mail and any attachments are confidential and may contain copyright material of Macquarie
Bank or third parties. If you are not the intended recipient of this email you should not
read, print, re-transmit, store or act in reliance on this e-mail or any attachments, and
should destroy all copies of them. Macquarie Bank does not guarantee the integrity of any
emails or any attached files. The views or opinions expressed are the author's own and may
not reflect the views or opinions of Macquarie Bank.

To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org

View raw message