J.Pietschmann wrote:
>Juergen Lippold wrote:
>> in my xml-document I'm using a value for the column-width in a table.
>> But this is a fixed value. Is it possible to work with values in percent
of the table-width?

>Not implemented yet.

>> There is one solution with the right direction to use a
proportional-column-width,
> > but this doesn't work with JFOR to create RTF-Files. Does someone knows
an other solution?

>No. Bad luck.
>You can try to code some advanced magic into you XSLT so that you
>can use a parameter to switch between percents and
>proportional-column-width.

>Something like
>  <xsl:variable name="total" select="column/@width"/>
>  <xsl:for-each select="column">
>    <xsl:choose>
>      <xsl:when test="$jfor">
>        <fo:table-column column-width="{@width}%"/>
>      </xsl:when>
>      <xsl:otherwise>
>        <fo:table-column column-width="proportional-column-width
({@width/$total})"/>
>      </xsl:otherwise>
>     <xsl:choose>
>   </xsl:for-each>

I did almost exactly that to support "proportional style" columns
in formatting results of an arbitrary SQL query in a servlet. I got a
lot of help understanding tables on this list from Karen Lease
last winter. The archives at MARC have that thread at

http://marc.theaimsgroup.com/?l=fop-dev&m=101179308205088&w=2

Now I go to those archives first for my questions. They are
a great asset, for FOP and many other useful applications.

Essentially, I store the width from the ResultSetMetaData in one of the
inputs to my servlet, and calculate the columns width in the xsl with

    <xsl:variable name="sum-width">
        <xsl:value-of select="sum(/database/report0/report-line[position()
='1']/child::*/@width)" />
    </xsl:variable>

and

<fo:table
     space-after.optimum="20pt"
     width="9.85in"
     table-layout="fixed">
     <xsl:for-each select="/database/report0/report-line[position()
='1']/child::*" >
          <xsl:variable name="pos"><xsl:value-of select="position()"
/></xsl:variable>
          <fo:table-column column-width="from-parent('width') * ({@width}
div {$sum-width})" column-number="{$pos}" />
     </xsl:for-each>

(Those measurements of 9.85 in. and 20pt. came from trial and error using
US Legal size paper, landscape orientation.)

It's all in FOP and Xalan. I didn't know about JFOR. I need to output PDF,
but something similar may work for you.

I'm sorry for the horrible way I fear that example will be formatted in
email.

 HTH,

 Joe


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to