RE: Same height rows in table

Hi Jonathan

There is a method that works for XEP formatter. The trick is to set block-progression-dimension to image height. See code below

   <fo:block-container block-progression-dimension="3in">
    <!--  wrapping container with height sufficient for inserted image -->
    <fo:table width="100%" table-layout="fixed">
     <fo:table-column column-width="80%"/>
     <fo:table-column column-width="20%"/>
     <fo:table-body>
      <fo:table-row>
       <fo:table-cell border-style="solid" height="50%">
        <!-- Set height to 50% of available area  -->
        <fo:block>A</fo:block>
       </fo:table-cell>
       <fo:table-cell number-rows-spanned="2" border-style="solid">
        <fo:block>
         <fo:instream-foreign-object height="100%" baseline-shift="-10%"
          content-height="scale-to-fit" scaling="uniform" role="checked checkbox">
          <svg:svg width="1.2in" height="2.7in" viewBox="0 0 100 300">
           <svg:text font-family="Helvetica" font-size="50" text-anchor="start" x="2" y="100">SVG</svg:text>
           <svg:text font-family="Helvetica" font-size="42" text-anchor="start" x="2" y="200"
           >Image</svg:text>
          </svg:svg>
         </fo:instream-foreign-object>
        </fo:block>
       </fo:table-cell>
      </fo:table-row>

      <fo:table-row>
       <fo:table-cell border-style="solid" height="100%">
        <!-- The 50% of area is already allocated, so set height to the rest of it - 100% of available area  -->
        <fo:block>C</fo:block>
       </fo:table-cell>
      </fo:table-row>

     </fo:table-body>
    </fo:table>
   </fo:block-container>

But it fails for FOP formatter (the version I tried is 0.93). Here is a part of its log:

SEVERE: Cannot find LM to handle given FO for LengthBase.                                                      16:06
Sep 11, 2007 3:39:39 PM org.apache.fop.layoutmgr.AbstractBaseLayoutManager getBaseLength
SEVERE: Cannot find LM to handle given FO for LengthBase.
Sep 11, 2007 3:39:39 PM org.apache.fop.layoutmgr.AbstractBaseLayoutManager getBaseLength
SEVERE: Cannot find LM to handle given FO for LengthBase.
Sep 11, 2007 3:39:39 PM org.apache.fop.layoutmgr.AbstractBaseLayoutManager getBaseLength
SEVERE: Cannot find LM to handle given FO for LengthBase.
Sep 11, 2007 3:39:39 PM org.apache.fop.layoutmgr.table.TableContentLayoutManager createElementsForRowGroup
WARNING: The contents of row 1 are taller than they should be (there is a block-progression-dimension or height cons
traint on the indicated row). Due to its contents the row grows to 14400 millipoints, but the row shouldn't get any
taller than MinOptMax[min=opt=max=0] millipoints. (fo:table-row, location: 17/21)

Maybe you should ask about similar trick for FOP in fop-user@xmlgraphics.apache.org mailing list.

Respectfully,
Volopdymyr Rodymyuk


> -----Original Message-----
> From: www-xsl-fo-request@w3.org [mailto:www-xsl-fo-request@w3.org] On
> Behalf Of Winterflood, Jonathan
> Sent: Monday, September 10, 2007 6:27 PM
> To: www-xsl-fo@w3.org
> Subject: Same height rows in table
>
>
> Hi,
>
> I'm trying to tell xsl-fo to keep all rows in a table the same height:
>
> The table contains 2 columns, and 2(n) rows.
> The second column spans all rows and contains a 'large' graphic and
> makes the table expand beyond the height required by the first column
> rows.
> In this case, the last row in the first column grows so the bottom edge
> matches that of the second column (like a table, fancy that!) and is
> therefore taller than the other rows.
>
> I would like all the rows to keep the same height, i.e. expand together
> to match the height of the second column.
>
> Current:    Wanted:
> +---+---+   +---+---+
> |   |   |   |   |   |
> +---+   |   |   |   |
> |   |   |   |   |   |
> |   |   |   +---+   |
> |   |   |   |   |   |
> |   |   |   |   |   |
> |   |   |   |   |   |
> +---+---+   +---+---+
>
> Is this possible without hard-coding the height of the lines? (I would
> rather not calculate the size of the content of the second column...)
>
> I have tried setting the table-row heights to 50% (100/n%), to no avail.
>
> Just in case it matters, I'm using Apache FOP for the rendering.
>
> Here is a (hopefully) minimal example:
>
> <?xml version="1.0" encoding="iso-8859-1"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
>  <xsl:template match="/">
> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
>  <fo:layout-master-set>
>   <fo:simple-page-master master-name="test">
>    <fo:region-body/>
>   </fo:simple-page-master>
>  </fo:layout-master-set>
>  <fo:page-sequence master-reference="test">
>   <fo:flow flow-name="xsl-region-body">
> <fo:table width="100%" table-layout="fixed">
>  <fo:table-column column-width="80%"/>
>  <fo:table-column column-width="20%"/>
>  <fo:table-body>
>   <fo:table-row>
>    <fo:table-cell border-style="solid">
>     <fo:block>A</fo:block>
>    </fo:table-cell>
>    <fo:table-cell number-rows-spanned="2" border-style="solid">
>     <fo:block>BBBBBBBB BBBBBBBB BBBBBBBB BBBBBBBB BBBBBBBB BBBBBBBB
> BBBBBBBB</fo:block>
>    </fo:table-cell>
>   </fo:table-row>
>   <fo:table-row>
>    <fo:table-cell border-style="solid">
>     <fo:block>C</fo:block>
>    </fo:table-cell>
>   </fo:table-row>
>  </fo:table-body>
> </fo:table>
>   </fo:flow>
>  </fo:page-sequence>
> </fo:root>
>  </xsl:template>
> </xsl:stylesheet>
>
> Regards,
>
> Jonathan Winterflood
>
>
> This message contains information that may be privileged or confidential
> and is the property of the Capgemini Group. It is intended only for the
> person to whom it is addressed. If you are not the intended recipient,
> you are not authorized to read, print, retain, copy, disseminate,
> distribute, or use this message or any part thereof. If you receive this
> message in error, please notify the sender immediately and delete all
> copies of this message.
>
>

Received on Tuesday, 11 September 2007 13:18:08 UTC