It worked (with some slight modifications).

Thanks very much to everyone who helped me solve this problem.

For those who are interested, here's the working code:

 <fo:table table-layout="fixed" width="100%">
    <fo:table-column column-width="proportional-column-width(.25)"/>
    <fo:table-column column-width="5.5in"/>
    <fo:table-column column-width="proportional-column-width(.25)"/>
     <fo:table-body>
       <fo:table-row>
         <fo:table-cell/>

       <!--  put the table you want centered in the middle cell --> 
       <!--  and centre that cell -->
         <fo:table-cell display-align="center">
             <fo:block text-align="center">
              <fo:table table-layout="fixed">               
               <fo:table-column column-width=".75in"/>
               <fo:table-column column-width=".75in"/>
               <fo:table-column column-width="2in"/>
               <fo:table-column column-width="2in"/>

               <!-- Fill the table -->
               <fo:table-body font-size="9pt" font-family="sans-serif">
                      <xsl:apply-templates select="YYYY" />
               </fo:table-body>
             </fo:table>
           </fo:block>
         </fo:table-cell>
       <fo:table-cell/>
    </fo:table-row>
 </fo:table-body>
</fo:table>


Cheers

Jon

-----Original Message-----
From: Clay Leeds [mailto:[EMAIL PROTECTED]
Sent: Monday, January 20, 2003 3:29 PM
To: [EMAIL PROTECTED]
Subject: Re: Centering a table


Jon,

Here's what I think J. meant to send you:

> You can use blind table columns with proportional column width
> for centering. The following will appear to center a 5cm
> column:
>   <fo:table table-layout="fixed" width="100%">
>     <fo:table-column column-width="proportional-column-width(1)"/>
>     <fo:table-column column-width="5cm"/>
>     <fo:table-column column-width="proportional-column-width(1)"/>
>     <fo:table-body>
>       <fo:table-row>
>         <fo:table-cell/>
>         <fo:table-cell>...<fo:table-cell>
>         <fo:table-cell/>
>       </fo:table-row>
>        ...
> Depending on your problem you can add the two columns for
> centering to the table you want to have centered, or you
> can use the code above and put the inner table into the
> cell with the content.
> 
> J.Pietschmann

In any case, the bottom line is that FOP doesn't really "center" tables. 
The workaround is that you'll need to nest the table you want "centered" 
in another table, and place table-columns to the left & right of the 
table-column which has the table you want centered. NOTE: I don't know 
the details on "proportional-column-width(1)" but if it does what I 
think it does, then that's pretty bitchin'!

Something like this:

   <fo:table table-layout="fixed" width="100%">
     <fo:table-column column-width="proportional-column-width(1)"/>
     <fo:table-column column-width="5.5cm"/>
<!-- changed from 5cm to 5.5cm to match apparent width of your table -->
     <fo:table-column column-width="proportional-column-width(1)"/>
     <fo:table-body>
       <fo:table-row>
         <fo:table-cell/>
         <fo:table-cell>
             <fo:block>
<!-- table you want centered -->
<fo:table table-layout="fixed">
       <fo:table-column column-width=".75in"/>
       <fo:table-column column-width=".75in"/>
       <fo:table-column column-width="2in"/>
       <fo:table-column column-width="2in"/>
       <fo:table-body font-size="9pt" font-family="sans-serif">
       <xsl:apply-templates select="reg_bit" mode="regs"/>
  </fo:table-body>
</fo:table>
             </fo:block>
           <fo:table-cell>
         <fo:table-cell/>
       </fo:table-row>
     </fo:table-body>
   </fo:table>

Of course, if you were going to be cool, you'd make this a template... :-)

Hope this helps!

Web Maestro Clay

Jon Steeves wrote:
> Hello.  Here's a newbie question:
> 
> Does anyone know how to center this table on a page.  I've tried a bunch of 
> stuff and nothing works.  Here's the code:
> 
> <fo:table table-layout="fixed">               
>        <fo:table-column column-width=".75in"/>
>        <fo:table-column column-width=".75in"/>
>        <fo:table-column column-width="2in"/>
>        <fo:table-column column-width="2in"/>
>        <fo:table-body font-size="9pt" font-family="sans-serif">
>        <xsl:apply-templates select="reg_bit" mode="regs"/>
>   </fo:table-body>
>  </fo:table>
> 
> Jon Steeves
> Technical Communications
> [EMAIL PROTECTED]



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

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

Reply via email to