You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Mathy V Arumugam <ma...@jpl.nasa.gov> on 2002/03/15 00:23:07 UTC
table: column-width
I need a table looking like this :)))
*******************************************************
* TEXT * Some
text *
* **************************************
* * Col 2 * Col3 * Col4
* Col N
*
*******************************************************
* 0 * 2 * 3 *
4 * 5 *
*******************************************************
* 6 * 7 * 8 *
9 * 10 *
*******************************************************
The number of columns is not a fixed number. I am able to create the
table but, having trouble with the column-width. The table should
expand to fit the page. The total-column-number is defined in TABLE
attribute.
Thanks
Mathy
Re: table: column-width
Posted by Mathy V Arumugam <ma...@jpl.nasa.gov>.
Apologies for the previous request! A better looking table is attached!
>
> The number of columns is not a fixed number. I am able to create the
> table but, having trouble with the column-width. The table should
> expand to fit the page. The total-column-number is defined in TABLE
> attribute.
>
> Thanks
> Mathy
Re: table: column-width
Posted by Mathy V Arumugam <ma...@jpl.nasa.gov>.
Thank you very much for your help! Works great.
Mathy
Rob Smith wrote:
> Chuck Paussa wrote:
> > <xsl:for-each select="1 to $numcols"> <!-- xsl 2 structure implemented
> in Saxon v7 -->
> > <xsl:for-each select="saxon:range(1, $numcols)"> <!-- extension
> function -->
> > <fo:table-column column-width="10mm"/>
> > </xsl:for-each>
>
> (presumably only one of the xsl:for-each elements should be included)
>
> You can also do this in pure XSLT using a recursive named template:
>
> <fo:table table-layout="fixed" width="100%">
> <xsl:call-template name="tablecols">
> <xsl:with-param name="count" value="$numcols"/>
> </xsl:call-template>
> ...
> </fo:table
>
> <xsl:template name="tablecols">
> <xsl:param name="count">
> <xsl:if test="$count>0">
> <fo:table-column/>
> <xsl:call-template name="tablecols">
> <xsl:with-param name="count" select="$count - 1"/>
> </xsl:call-template>
> </xsl:if>
> </xsl:template>
>
> In FOP 0.20.3, if the table width is fixed (eg. 100%) and no width is specified for some or all columns, the available width is divided equally between those columns.
> --
> Rob Smith
RE: table: column-width
Posted by Rob Smith <ro...@ifrsys.com>.
Chuck Paussa wrote:
> <xsl:for-each select="1 to $numcols"> <!-- xsl 2 structure implemented
in Saxon v7 -->
> <xsl:for-each select="saxon:range(1, $numcols)"> <!-- extension
function -->
> <fo:table-column column-width="10mm"/>
> </xsl:for-each>
(presumably only one of the xsl:for-each elements should be included)
You can also do this in pure XSLT using a recursive named template:
<fo:table table-layout="fixed" width="100%">
<xsl:call-template name="tablecols">
<xsl:with-param name="count" value="$numcols"/>
</xsl:call-template>
...
</fo:table
<xsl:template name="tablecols">
<xsl:param name="count">
<xsl:if test="$count>0">
<fo:table-column/>
<xsl:call-template name="tablecols">
<xsl:with-param name="count" select="$count - 1"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
In FOP 0.20.3, if the table width is fixed (eg. 100%) and no width is specified for some or all columns, the available width is divided equally between those columns.
--
Rob Smith
Re: table: column-width
Posted by Chuck Paussa <Ch...@systems.dhl.com>.
Mathy,
To do the variable number of columns, you'll have to use a range
function like this
<fo:table>
<xsl:variable name="numcols" select="./table/@numcols"/>
<xsl:for-each select="1 to $numcols"> <!-- xsl 2 structure i,plemented
in Saxon v7 -->
<xsl:for-each select="saxon:range(1, $numcols)"> <!-- extension
function -->
<fo:table-column column-width="10mm"/>
</xsl:for-each>
To do the column and row spanning, use number-columns-spanned and
number-rows-spanned
<fo:table-cell border="solid silver 1px" number-rows-spanned="2"
display-align="after">
<fo:table-cell border="solid black 1px" number-columns-spanned="2"
text-align="center">
Chuck
Mathy V Arumugam wrote:
>I need a table looking like this :)))
>
>*******************************************************
>* TEXT * Some
>text *
>* **************************************
>* * Col 2 * Col3 * Col4
>* Col N
>*
>*******************************************************
>* 0 * 2 * 3 *
>4 * 5 *
>*******************************************************
>* 6 * 7 * 8 *
>9 * 10 *
>*******************************************************
>
>The number of columns is not a fixed number. I am able to create the
>table but, having trouble with the column-width. The table should
>expand to fit the page. The total-column-number is defined in TABLE
>attribute.
>
>Thanks
>Mathy
>